File indexing completed on 2025-01-18 10:05:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _XCAFPrs_DocumentIdIterator_HeaderFile
0016 #define _XCAFPrs_DocumentIdIterator_HeaderFile
0017
0018 #include <XCAFPrs_Style.hxx>
0019
0020
0021 class XCAFPrs_DocumentIdIterator
0022 {
0023 public:
0024
0025 XCAFPrs_DocumentIdIterator (const TCollection_AsciiString& thePath)
0026 : myPath (thePath), myPosition (0)
0027 {
0028 Next();
0029 }
0030
0031
0032 bool More() const { return !mySubId.IsEmpty(); }
0033
0034
0035 const TCollection_AsciiString& Value() const { return mySubId; }
0036
0037
0038 void Next();
0039
0040 private:
0041
0042
0043 XCAFPrs_DocumentIdIterator& operator= (const XCAFPrs_DocumentIdIterator& );
0044
0045 private:
0046 const TCollection_AsciiString& myPath;
0047 TCollection_AsciiString mySubId;
0048 Standard_Integer myPosition;
0049 };
0050
0051
0052
0053
0054
0055 inline void XCAFPrs_DocumentIdIterator::Next()
0056 {
0057 for (Standard_Integer aCharIndex = myPosition + 1; aCharIndex <= myPath.Length(); ++aCharIndex)
0058 {
0059 if (myPath.Value (aCharIndex) == '/')
0060 {
0061
0062 const Standard_Integer aLen = aCharIndex - myPosition - 2;
0063 if (aLen < 1)
0064 {
0065 return;
0066 }
0067
0068 mySubId = myPath.SubString (myPosition + 1, aCharIndex - 2);
0069 myPosition = aCharIndex;
0070 return;
0071 }
0072 }
0073 if (myPosition < myPath.Length())
0074 {
0075
0076 mySubId = myPath.SubString (myPosition + 1, myPath.Length() - 1);
0077 myPosition = myPath.Length();
0078 }
0079 else
0080 {
0081 mySubId.Clear();
0082 myPosition = myPath.Length();
0083 }
0084 }
0085
0086 #endif