public:
- CharactersPage(const Standard_Integer theMaxCar) :myNext(NULL), myUsed(0)
+ CharactersPage(const Standard_Integer theMaxCar) :myNext(nullptr), myUsed(0)
{
myCharacters = new char[theMaxCar];
}
~CharactersPage()
{
- if (myCharacters != NULL)
+ if (myCharacters != nullptr)
{
delete[] myCharacters;
- myCharacters = NULL;
+ myCharacters = nullptr;
}
}
+ DEFINE_STANDARD_ALLOC
public:
CharactersPage* myNext; //!< Chaining of character pages
public:
- Argument() :myNext(NULL), myValue(NULL), myType(Interface_ParamSub) {}
+ Argument() :myNext(nullptr), myValue(nullptr), myType(Interface_ParamSub) {}
~Argument() {}
public:
- ArgumentsPage(Standard_Integer theMaxArg) :myNext(NULL), myUsed(0)
+ ArgumentsPage(Standard_Integer theMaxArg) :myNext(nullptr), myUsed(0)
{
myArgs = new Argument[theMaxArg];
}
~ArgumentsPage()
{
delete[] myArgs;
- myArgs = NULL;
+ myArgs = nullptr;
}
public:
public:
- Record() :myNext(NULL), myFirst(NULL), myIdent(NULL), myType(NULL) {}
+ Record() :myNext(nullptr), myFirst(nullptr), myLast(nullptr), myIdent(nullptr), myType(nullptr) {}
~Record() {}
Record* myNext; //!< Next record in the list
Argument* myFirst; //!< First argument in the record
+ Argument* myLast; //!< Last argument in the record
char* myIdent; //!< Record identifier (Example: "#12345") or scope-end
char* myType; //!< Type of the record
};
public:
- Scope() :myPrevious(NULL), myRecord(NULL) {}
+ Scope() :myPrevious(nullptr), myRecord(nullptr) {}
~Scope()
{
- if (myRecord != NULL)
+ if (myRecord != nullptr)
{
delete[] myRecord;
- myRecord = NULL;
+ myRecord = nullptr;
}
}
public:
- RecordsPage(const Standard_Integer theMaxRec) :myNext(NULL), myUsed(0)
+ RecordsPage(const Standard_Integer theMaxRec) :myNext(nullptr), myUsed(0)
{
myRecords = new Record[theMaxRec];
}
~RecordsPage()
{
- if (myRecords != NULL)
+ if (myRecords != nullptr)
{
delete[] myRecords;
- myRecords = NULL;
+ myRecords = nullptr;
}
}
-
+ DEFINE_STANDARD_ALLOC
public:
RecordsPage* myNext; //!< Chaining of records pages
public:
- ErrorsPage(Standard_CString theError) :myNext(NULL), myError(theError)
+ ErrorsPage(Standard_CString theError) :myNext(nullptr), myError(theError)
{}
//! Returns point to the next ErrorsPage
//! Returns an error message
Standard_CString ErrorMessage() const { return myError.ToCString(); }
+ DEFINE_STANDARD_ALLOC
private:
ErrorsPage* myNext; //!< Chaining of records pages
StepFile_ReadData::StepFile_ReadData()
:myMaxChar(50000), myMaxRec(5000), myMaxArg(10000), myModePrint(0),
myNbRec(0), myNbHead(0), myNbPar(0), myYaRec(0),
- myNumSub(0), myErrorArg(Standard_False), myResText(NULL), myCurrType(TextValue::SubList),
- mySubArg(NULL), myTypeArg(Interface_ParamSub), myCurrArg(NULL), myFirstRec(NULL),
- myCurRec(NULL), myLastRec(NULL), myCurScope(NULL), myFirstError(NULL), myCurError(NULL)
+ myNumSub(0), myErrorArg(Standard_False), myResText(nullptr), myCurrType(TextValue::SubList),
+ mySubArg(nullptr), myTypeArg(Interface_ParamSub), myCurrArg(nullptr), myFirstRec(nullptr),
+ myCurRec(nullptr), myLastRec(nullptr), myCurScope(nullptr), myFirstError(nullptr), myCurError(nullptr)
{
myOneCharPage = new CharactersPage(myMaxChar);
myOneArgPage = new ArgumentsPage(myMaxArg);
SetTypeArg(Interface_ParamSub);
mySubArg = myCurRec->myIdent;
myCurRec = myCurRec->myNext;
- myLastRec->myNext = NULL;
+ myLastRec->myNext = nullptr;
}
//=======================================================================
{
myCurRec = CreateNewRecord();
GetResultText(&myCurRec->myIdent);
- myCurRec->myNext = NULL;
- myCurRec->myFirst = NULL;
+ myCurRec->myNext = nullptr;
+ myCurRec->myFirst = nullptr;
+ myCurRec->myLast = nullptr;
myYaRec = 1;
}
{
myCurRec = CreateNewRecord();
myCurRec->myIdent = TextValue::IdZero;
- myCurRec->myNext = NULL;
- myCurRec->myFirst = NULL;
+ myCurRec->myNext = nullptr;
+ myCurRec->myFirst = nullptr;
+ myCurRec->myLast = nullptr;
}
GetResultText(&myCurRec->myType);
myYaRec = myNumSub = 0;
aSubRec->myType = myCurrType;
myCurrType = TextValue::SubList;
aSubRec->myNext = myCurRec;
- aSubRec->myFirst = NULL;
+ aSubRec->myFirst = nullptr;
+ aSubRec->myLast = nullptr;
myCurRec = aSubRec;
}
myErrorArg = Standard_False; // Reset error arguments mode
if (myTypeArg == Interface_ParamMisc)
myErrorArg = Standard_True;
- if (myCurRec->myFirst == NULL)
+ if (myCurRec->myFirst == nullptr)
{
myCurRec->myFirst = aNewArg;
+ myCurRec->myLast = aNewArg;
+ }
+ else if (myCurRec->myLast == nullptr)
+ {
+ myCurRec->myFirst->myNext = aNewArg;
+ myCurRec->myLast = aNewArg;
}
else
{
- Argument* aNextArg = myCurRec->myFirst;
- while (aNextArg->myNext != NULL)
- aNextArg = aNextArg->myNext;
+ Argument* aNextArg = myCurRec->myLast;
aNextArg->myNext = aNewArg;
+ myCurRec->myLast = aNewArg;
}
- aNewArg->myNext = NULL;
+ aNewArg->myNext = nullptr;
}
//=======================================================================
return;
}
- Argument* aCurrArg = myCurRec->myFirst;
- while (aCurrArg->myNext != NULL)
- aCurrArg = aCurrArg->myNext;
-
+ Argument* aCurrArg = myCurRec->myLast;
GetResultText(&aCurrArg->myValue);
}
aRecord = CreateNewRecord();
aRecord->myIdent = TextValue::Scope;
aRecord->myType = TextValue::Nil;
- aRecord->myFirst = NULL;
+ aRecord->myFirst = nullptr;
+ aRecord->myLast = nullptr;
AddNewRecord(aRecord);
}
{
Scope* anOldScope;
Record* aRecord;
- if (myCurScope == NULL) return;
+ if (myCurScope == nullptr) return;
aRecord = CreateNewRecord();
aRecord->myIdent = TextValue::Scope;
aRecord->myType = TextValue::Nil;
- aRecord->myFirst = NULL;
+ aRecord->myFirst = nullptr;
+ aRecord->myLast = nullptr;
if (mySubArg[0] == '$')
{
{
if (theMode & 1)
{
- while (myOneRecPage != NULL)
+ while (myOneRecPage != nullptr)
{
RecordsPage* aNewPage = myOneRecPage->myNext;
delete myOneRecPage;
myOneRecPage = aNewPage;
}
- while (myOneArgPage != NULL) {
+ while (myOneArgPage != nullptr) {
ArgumentsPage* aNewPage = myOneArgPage->myNext;
delete myOneArgPage;
myOneArgPage = aNewPage;
}
- while (myFirstError != NULL)
+ while (myFirstError != nullptr)
{
ErrorsPage* aNewErrorPage = myFirstError->NextErrorPage();
delete myFirstError;
}
if (theMode & 2)
{
- while (myOneCharPage != NULL)
+ while (myOneCharPage != nullptr)
{
CharactersPage* aNewPage = myOneCharPage->myNext;
delete myOneCharPage;
Standard_Boolean StepFile_ReadData::GetArgDescription(Interface_ParamType* theType, char** theValue)
{
- if (myCurrArg == NULL)
+ if (myCurrArg == nullptr)
return Standard_False;
*theType = myCurrArg->myType;
*theValue = myCurrArg->myValue;
char** theType,
int* theNbArg)
{
- if (myCurRec == NULL)
+ if (myCurRec == nullptr)
return Standard_False;
*theIdent = myCurRec->myIdent;
*theType = myCurRec->myType;
- *theNbArg = (myCurRec->myFirst != NULL);
+ *theNbArg = (myCurRec->myFirst != nullptr);
myCurrArg = myCurRec->myFirst;
return Standard_True;
}
//=======================================================================
void StepFile_ReadData::AddError(Standard_CString theErrorMessage)
{
- if (myFirstError == NULL)
+ if (myFirstError == nullptr)
{
myFirstError = new ErrorsPage(theErrorMessage);
myCurError = myFirstError;
//=======================================================================
Standard_Boolean StepFile_ReadData::ErrorHandle(const Handle(Interface_Check)& theCheck) const
{
- if (myFirstError != NULL)
+ if (myFirstError != nullptr)
{
ErrorsPage* aCurrent = myFirstError;
- while (aCurrent != NULL)
+ while (aCurrent != nullptr)
{
theCheck->AddFail(aCurrent->ErrorMessage(), "Undefined Parsing");
aCurrent = aCurrent->NextErrorPage();
}
}
- return myFirstError == NULL;
+ return myFirstError == nullptr;
}
//=======================================================================
//=======================================================================
Standard_CString StepFile_ReadData::GetLastError() const
{
- return myCurError != NULL ? myCurError->ErrorMessage() : NULL;
+ return myCurError != nullptr ? myCurError->ErrorMessage() : nullptr;
}
//=======================================================================
void StepFile_ReadData::AddNewRecord(Record* theNewRecord)
{
myNbRec++;
- if (myFirstRec == NULL) myFirstRec = theNewRecord;
- if (myLastRec != NULL) myLastRec->myNext = theNewRecord;
+ if (myFirstRec == nullptr) myFirstRec = theNewRecord;
+ if (myLastRec != nullptr) myLastRec->myNext = theNewRecord;
myLastRec = theNewRecord;
}
int aNumArg = 0;
int aNumLen = 0;
int anArgLen = 0;
- if (theRecord == NULL) { Printf("Non defini\n"); return; }
+ if (theRecord == nullptr) { Printf("Not defined\n"); return; }
Printf("Ident : %s Type : %s Nb.Arg.s : %s\n",
theRecord->myIdent, theRecord->myType,
(theRecord->myFirst ? theRecord->myFirst->myValue : ""));
if (myModePrint < 2) return;
myCurrArg = theRecord->myFirst;
- while (myCurrArg != NULL)
+ while (myCurrArg != nullptr)
{
aNumArg++;
anArgLen = (int)strlen(myCurrArg->myValue) + 18;