Skip to content

Commit

Permalink
Coding - Update method guards for consistency #333
Browse files Browse the repository at this point in the history
Apply new regex replacement with method's guards in .cxx
Update GH workflow with style checking
  • Loading branch information
dpasukhi authored Feb 3, 2025
1 parent 3ce9ec7 commit 1f386af
Show file tree
Hide file tree
Showing 283 changed files with 4,815 additions and 9,694 deletions.
9 changes: 7 additions & 2 deletions .github/actions/clang-format-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ runs:
run: |
git diff > format.patch
if ((Get-Item format.patch).length -gt 0) {
echo "::error::Files need formatting. To fix: 1. Download format.patch 2. \"git apply format.patch\" 3. Commit and push"
echo "has_changes=true" >> $env:GITHUB_OUTPUT
exit 1
}
- name: Upload patch
Expand All @@ -73,6 +71,13 @@ runs:
name: format-patch
path: format.patch

- name: Failing step for formatting issues
if: steps.git-check.outputs.has_changes == 'true'
shell: pwsh
run: |
echo "::error::Files need formatting. To fix: 1. Download format.patch 2. \"git apply format.patch\" 3. Commit and push"
exit 1
branding:
icon: 'check-square'
color: 'green'
6 changes: 2 additions & 4 deletions src/AIS/AIS_GlobalStatus.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@

IMPLEMENT_STANDARD_RTTIEXT(AIS_GlobalStatus, Standard_Transient)

// =======================================================================
// function : AIS_GlobalStatus
// purpose :
// =======================================================================
//=================================================================================================

AIS_GlobalStatus::AIS_GlobalStatus()
: myDispMode(0),
myIsHilit(Standard_False),
Expand Down
24 changes: 8 additions & 16 deletions src/AIS/AIS_InteractiveContext.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3282,10 +3282,8 @@ void AIS_InteractiveContext::AddOrRemoveSelected(const Handle(SelectMgr_EntityOw
}
}

// =======================================================================
// function : SetSelectedState
// purpose :
// =======================================================================
//=================================================================================================

Standard_Boolean AIS_InteractiveContext::SetSelectedState(
const Handle(SelectMgr_EntityOwner)& theEntity,
const Standard_Boolean theIsSelected)
Expand Down Expand Up @@ -3676,10 +3674,8 @@ void AIS_InteractiveContext::SetSelectionModeActive(
(*aStat)->AddSelectionMode(theMode);
}

// ============================================================================
// function : Activate
// purpose :
// ============================================================================
//=================================================================================================

void AIS_InteractiveContext::Activate(const Standard_Integer theMode,
const Standard_Boolean theIsForce)
{
Expand All @@ -3692,10 +3688,8 @@ void AIS_InteractiveContext::Activate(const Standard_Integer theMode,
}
}

// ============================================================================
// function : Deactivate
// purpose :
// ============================================================================
//=================================================================================================

void AIS_InteractiveContext::Deactivate(const Standard_Integer theMode)
{
AIS_ListOfInteractive aDisplayedObjects;
Expand All @@ -3706,10 +3700,8 @@ void AIS_InteractiveContext::Deactivate(const Standard_Integer theMode)
}
}

// ============================================================================
// function : Deactivate
// purpose :
// ============================================================================
//=================================================================================================

void AIS_InteractiveContext::Deactivate()
{
AIS_ListOfInteractive aDisplayedObjects;
Expand Down
78 changes: 26 additions & 52 deletions src/AIS/AIS_LightSource.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,17 @@
IMPLEMENT_STANDARD_RTTIEXT(AIS_LightSource, AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(AIS_LightSourceOwner, SelectMgr_EntityOwner)

// =======================================================================
// function : AIS_LightSourceOwner
// purpose :
// =======================================================================
//=================================================================================================

AIS_LightSourceOwner::AIS_LightSourceOwner(const Handle(AIS_LightSource)& theObject,
Standard_Integer thePriority)
: SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)theObject, thePriority)
{
//
}

// =======================================================================
// function : HandleMouseClick
// purpose :
// =======================================================================
//=================================================================================================

Standard_Boolean AIS_LightSourceOwner::HandleMouseClick(const Graphic3d_Vec2i&,
Aspect_VKeyMouse theKey,
Aspect_VKeyFlags theFlags,
Expand Down Expand Up @@ -167,10 +163,8 @@ Standard_Boolean AIS_LightSourceOwner::IsForcedHilight() const
return Standard_False;
}

// =======================================================================
// function : Constructor
// purpose :
// =======================================================================
//=================================================================================================

AIS_LightSource::AIS_LightSource(const Handle(Graphic3d_CLight)& theLight)
: myLightSource(theLight),
myCodirMarkerType(Aspect_TOM_X),
Expand Down Expand Up @@ -295,10 +289,8 @@ Standard_Boolean AIS_LightSource::ProcessDragging(const Handle(AIS_InteractiveCo
return Standard_False;
}

// =======================================================================
// function : updateLightAspects
// purpose :
// =======================================================================
//=================================================================================================

void AIS_LightSource::updateLightAspects()
{
const Quantity_Color aBaseColor = myLightSource->Color();
Expand Down Expand Up @@ -333,10 +325,8 @@ void AIS_LightSource::updateLightAspects()
SynchronizeAspects();
}

// =======================================================================
// function : updateLightTransformPersistence
// purpose :
// =======================================================================
//=================================================================================================

void AIS_LightSource::updateLightTransformPersistence()
{
Handle(Graphic3d_TransformPers) aTrsfPers = myTransformPersistence;
Expand Down Expand Up @@ -421,10 +411,8 @@ void AIS_LightSource::updateLightTransformPersistence()
SetTransformPersistence(aTrsfPers);
}

// =======================================================================
// function : updateLightLocalTransformation
// purpose :
// =======================================================================
//=================================================================================================

void AIS_LightSource::updateLightLocalTransformation()
{
myLocalTransformation.Nullify();
Expand Down Expand Up @@ -470,10 +458,8 @@ void AIS_LightSource::updateLightLocalTransformation()
UpdateTransformation();
}

// =======================================================================
// function : setLocalTransformation
// purpose :
// =======================================================================
//=================================================================================================

void AIS_LightSource::setLocalTransformation(const Handle(TopLoc_Datum3D)& theTrsf)
{
const gp_Trsf aTrsf = !theTrsf.IsNull() ? theTrsf->Transformation() : gp_Trsf();
Expand Down Expand Up @@ -513,10 +499,8 @@ void AIS_LightSource::setLocalTransformation(const Handle(TopLoc_Datum3D)& theTr
updateLightTransformPersistence();
}

// =======================================================================
// function : Compute
// purpose :
// =======================================================================
//=================================================================================================

void AIS_LightSource::Compute(const Handle(PrsMgr_PresentationManager)&,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
Expand Down Expand Up @@ -559,10 +543,8 @@ void AIS_LightSource::Compute(const Handle(PrsMgr_PresentationManager)&,
}
}

// =======================================================================
// function : computeAmbient
// purpose :
// =======================================================================
//=================================================================================================

void AIS_LightSource::computeAmbient(const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
Expand Down Expand Up @@ -635,10 +617,8 @@ void AIS_LightSource::computeAmbient(const Handle(Prs3d_Presentation)& thePrs,
}
}

// =======================================================================
// function : computeDirectional
// purpose :
// =======================================================================
//=================================================================================================

void AIS_LightSource::computeDirectional(const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
Expand Down Expand Up @@ -763,10 +743,8 @@ void AIS_LightSource::computeDirectional(const Handle(Prs3d_Presentation)& thePr
}
}

// =======================================================================
// function : computePositional
// purpose :
// =======================================================================
//=================================================================================================

void AIS_LightSource::computePositional(const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
Expand All @@ -792,10 +770,8 @@ void AIS_LightSource::computePositional(const Handle(Prs3d_Presentation)& thePrs
}
}

// =======================================================================
// function : computeSpot
// purpose :
// =======================================================================
//=================================================================================================

void AIS_LightSource::computeSpot(const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
Expand Down Expand Up @@ -851,10 +827,8 @@ void AIS_LightSource::computeSpot(const Handle(Prs3d_Presentation)& thePrs,
}
}

// =======================================================================
// function : ComputeSelection
// purpose :
// =======================================================================
//=================================================================================================

void AIS_LightSource::ComputeSelection(const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
Expand Down
36 changes: 12 additions & 24 deletions src/AIS/AIS_MediaPlayer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ AIS_MediaPlayer::~AIS_MediaPlayer()
myFramePair.Nullify();
}

// =======================================================================
// function : OpenInput
// purpose :
// =======================================================================
//=================================================================================================

void AIS_MediaPlayer::OpenInput(const TCollection_AsciiString& thePath, Standard_Boolean theToWait)
{
if (myFramePair->PlayerContext().IsNull() && thePath.IsEmpty())
Expand All @@ -86,10 +84,8 @@ void AIS_MediaPlayer::OpenInput(const TCollection_AsciiString& thePath, Standard
SynchronizeAspects();
}

// =======================================================================
// function : PresentFrame
// purpose :
// =======================================================================
//=================================================================================================

bool AIS_MediaPlayer::PresentFrame(const Graphic3d_Vec2i& theLeftCorner,
const Graphic3d_Vec2i& theMaxSize)
{
Expand Down Expand Up @@ -128,10 +124,8 @@ bool AIS_MediaPlayer::PresentFrame(const Graphic3d_Vec2i& theLeftCorner,
return toRedraw;
}

// =======================================================================
// function : updateSize
// purpose :
// =======================================================================
//=================================================================================================

bool AIS_MediaPlayer::updateSize(const Graphic3d_Vec2i& theLeftCorner,
const Graphic3d_Vec2i& theMaxSize)
{
Expand Down Expand Up @@ -185,10 +179,8 @@ bool AIS_MediaPlayer::updateSize(const Graphic3d_Vec2i& theLeftCorner,
return true;
}

// =======================================================================
// function : PlayPause
// purpose :
// =======================================================================
//=================================================================================================

void AIS_MediaPlayer::PlayPause()
{
if (myFramePair->PlayerContext().IsNull())
Expand All @@ -201,10 +193,8 @@ void AIS_MediaPlayer::PlayPause()
myFramePair->PlayerContext()->PlayPause(isPaused, aProgress, aDuration);
}

// =======================================================================
// function : Compute
// purpose :
// =======================================================================
//=================================================================================================

void AIS_MediaPlayer::Compute(const Handle(PrsMgr_PresentationManager)&,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
Expand All @@ -227,10 +217,8 @@ void AIS_MediaPlayer::Compute(const Handle(PrsMgr_PresentationManager)&,
}
}

// =======================================================================
// function : ComputeSelection
// purpose :
// =======================================================================
//=================================================================================================

void AIS_MediaPlayer::ComputeSelection(const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
Expand Down
6 changes: 2 additions & 4 deletions src/AIS/AIS_Trihedron.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -738,10 +738,8 @@ Handle(Select3D_SensitiveEntity) AIS_Trihedron::createSensitiveEntity(
return Handle(Select3D_SensitiveEntity)();
}

// =======================================================================
// function : updatePrimitives
// purpose :
// =======================================================================
//=================================================================================================

void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
Prs3d_DatumMode theMode,
const gp_Pnt& theOrigin,
Expand Down
Loading

0 comments on commit 1f386af

Please sign in to comment.