Salome HOME
Check-in operation without any modifications is possible
[tools/simanio.git] / src / SimanIO_Document.cxx
1 #include <SimanIO_Document.hxx>
2
3 using namespace std;
4
5 SimanIO_Document::SimanIO_Document()
6 {
7 }
8
9 void SimanIO_Document::SetName(const char* theName)
10 {
11   myName = theName;
12 }
13
14 const char* SimanIO_Document::Name() const
15 {
16   return myName.c_str();
17 }
18
19 void SimanIO_Document::AddFile(const bool isResult, const char* theURL,
20                                const AutomaticProcessing theProc, const FileState theState)
21 {
22   SimanIO_File aFile = {theURL, isResult, theProc, theState};
23   AddFile(aFile);
24 }
25
26 void SimanIO_Document::AddFile(const SimanIO_File& theFile)
27 {
28   myFiles.push_back(theFile);
29 }
30
31 const SimanIO_File& SimanIO_Document::File(const int theId) const
32 {
33   DocumentFiles::const_iterator aFIter = myFiles.begin();
34   for(; aFIter != myFiles.end(); aFIter++) {
35     if (aFIter->id == theId)
36       return *aFIter;
37   }
38   static SimanIO_File anEmpty;
39   return anEmpty;
40 }
41
42 //////////////////////////// Iterator methods /////////////////////////
43 SimanIO_Document::FilesIterator::FilesIterator(/*const*/ SimanIO_Document& theDocument)
44 {
45   myIter = theDocument.myFiles.begin();
46   myEnd = theDocument.myFiles.end();
47 }
48
49 void SimanIO_Document::FilesIterator::Next()
50 {
51   myIter++;
52 }
53
54 bool SimanIO_Document::FilesIterator::More()
55 {
56   return myIter != myEnd; 
57 }
58 const bool SimanIO_Document::FilesIterator::IsResult()
59 {
60   return myIter->result;
61 }
62
63 const char* SimanIO_Document::FilesIterator::URL()
64 {
65   return myIter->url.c_str();
66 }
67
68 void SimanIO_Document::FilesIterator::SetURL(const char* theURL)
69 {
70   myIter->url = theURL;
71   //myIter->url(theURL);
72   //std::string test = "abc";
73   //myIter->url(test);
74 }
75
76 const AutomaticProcessing SimanIO_Document::FilesIterator::GetProcessing()
77 {
78   return myIter->proc;
79 }
80
81 const FileState SimanIO_Document::FilesIterator::GetState()
82 {
83   return myIter->state;
84 }
85
86 const int SimanIO_Document::FilesIterator::Id()
87 {
88   return myIter->id;
89 }