Changeset 365 for trunk/src/core/RpLibrary.cc
- Timestamp:
- Mar 14, 2006 11:38:29 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/RpLibrary.cc
r224 r365 110 110 parent = scew_element_parent(node); 111 111 112 // if (name == NULL) { 113 if (name.empty()) { 114 siblings = scew_element_list(parent, type, &count); 115 if (count > 0) { 116 tmpCount = count; 117 while ((index < tmpCount) && (siblings[index] != node)) { 118 index++; 119 } 120 121 if (index < tmpCount) { 122 123 if (index > 0) { 124 125 retVal << type << --index; 112 if (parent) { 113 114 // if (name == NULL) { 115 if (name.empty()) { 116 siblings = scew_element_list(parent, type, &count); 117 if (count > 0) { 118 tmpCount = count; 119 while ((index < tmpCount) && (siblings[index] != node)) { 120 index++; 126 121 } 127 else { 128 129 retVal << type; 122 123 if (index < tmpCount) { 124 125 if (index > 0) { 126 127 retVal << type << --index; 128 } 129 else { 130 131 retVal << type; 132 } 133 134 /* 135 if (retVal == NULL) { 136 // error with allocating space 137 return NULL; 138 } 139 */ 130 140 } 131 132 /* 133 if (retVal == NULL) { 134 // error with allocating space 135 return NULL; 136 } 137 */ 138 } 139 } 140 141 scew_element_list_free(siblings); 142 143 } 144 else { 145 146 retVal << name; 141 } 142 143 scew_element_list_free(siblings); 144 145 } 146 else { 147 148 retVal << name; 149 } 147 150 } 148 151 … … 173 176 parent = scew_element_parent(node); 174 177 175 if (name.empty()) { 176 siblings = scew_element_list(parent, type, &count); 177 if (count > 0) { 178 tmpCount = count; 179 // figure out what the index value should be 180 while ((index < tmpCount) && (siblings[index] != node)) { 181 index++; 182 } 183 184 if (index < tmpCount) { 185 if (index > 0) { 186 retVal << type << --index; 178 if (parent) { 179 if (name.empty()) { 180 siblings = scew_element_list(parent, type, &count); 181 if (count > 0) { 182 tmpCount = count; 183 // figure out what the index value should be 184 while ((index < tmpCount) && (siblings[index] != node)) { 185 index++; 187 186 } 188 else { 189 retVal << type; 187 188 if (index < tmpCount) { 189 if (index > 0) { 190 retVal << type << --index; 191 } 192 else { 193 retVal << type; 194 } 190 195 } 191 } 196 197 } 198 else { 199 // count == 0 ??? this state should never be reached 200 } 201 scew_element_list_free(siblings); 192 202 193 203 } 194 204 else { 195 // count == 0 ??? this state should never be reached 196 } 197 scew_element_list_free(siblings); 198 199 } 200 else { 201 // node has attribute id 202 retVal << type << "(" << name << ")"; 203 205 // node has attribute id 206 retVal << type << "(" << name << ")"; 207 208 } 204 209 } 205 210 … … 781 786 782 787 if (path.empty()) { 783 // an empty path returns the current RpLibrary784 return this;788 // an empty path returns the parent of the current RpLibrary 789 path = this->nodePath(); 785 790 } 786 791 … … 945 950 946 951 return retLib; 952 } 953 954 /**********************************************************************/ 955 // METHOD: children() 956 /// Returns a std::list<RpLibrary*> of all children under 'path' 957 // 958 // 959 /** 960 */ 961 962 RpLibrary& 963 RpLibrary::childCount ( std::string path, 964 int* childCount) 965 { 966 scew_element* parentNode; 967 int myChildCount = 0; 968 969 if (this->root) { 970 971 if (path.empty()) { 972 // an empty path uses the current RpLibrary as parent 973 parentNode = this->root; 974 } 975 976 if (parentNode) { 977 myChildCount = scew_element_count(parentNode); 978 } 979 980 if (childCount) { 981 *childCount = myChildCount; 982 } 983 984 } 985 986 return *this; 987 } 988 989 /**********************************************************************/ 990 // METHOD: isNull() 991 /// returns whether this RpLibrary is a valid library node 992 // 993 // 994 /** 995 */ 996 997 bool 998 RpLibrary::isNull () 999 { 1000 if (this->root) { 1001 return false; 1002 } 1003 1004 return true; 947 1005 } 948 1006
Note: See TracChangeset
for help on using the changeset viewer.