File indexing completed on 2026-09-21 09:19:09
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),
0027 myPosition(0)
0028 {
0029 Next();
0030 }
0031
0032
0033 bool More() const { return !mySubId.IsEmpty(); }
0034
0035
0036 const TCollection_AsciiString& Value() const { return mySubId; }
0037
0038
0039 void Next();
0040
0041 private:
0042
0043 XCAFPrs_DocumentIdIterator& operator=(const XCAFPrs_DocumentIdIterator&) = delete;
0044
0045 private:
0046 const TCollection_AsciiString& myPath;
0047 TCollection_AsciiString mySubId;
0048 int myPosition;
0049 };
0050
0051
0052
0053 inline void XCAFPrs_DocumentIdIterator::Next()
0054 {
0055 for (int aCharIndex = myPosition + 1; aCharIndex <= myPath.Length(); ++aCharIndex)
0056 {
0057 if (myPath.Value(aCharIndex) == '/')
0058 {
0059
0060 const int aLen = aCharIndex - myPosition - 2;
0061 if (aLen < 1)
0062 {
0063 return;
0064 }
0065
0066 mySubId = myPath.SubString(myPosition + 1, aCharIndex - 2);
0067 myPosition = aCharIndex;
0068 return;
0069 }
0070 }
0071 if (myPosition < myPath.Length())
0072 {
0073
0074 mySubId = myPath.SubString(myPosition + 1, myPath.Length() - 1);
0075 myPosition = myPath.Length();
0076 }
0077 else
0078 {
0079 mySubId.Clear();
0080 myPosition = myPath.Length();
0081 }
0082 }
0083
0084 #endif