| 140 | } |
| 141 | |
| 142 | void SceneInterface::pathToString( const SceneInterface::Path &p, std::string &path ) |
| 143 | { |
| 144 | if ( !p.size() ) |
| 145 | { |
| 146 | path = "/"; |
| 147 | return; |
| 148 | } |
| 149 | size_t totalLength = 0; |
| 150 | for ( SceneInterface::Path::const_iterator it = p.begin(); it != p.end(); it++ ) |
| 151 | { |
| 152 | totalLength += it->value().size(); |
| 153 | } |
| 154 | totalLength += p.size(); |
| 155 | |
| 156 | path.resize( totalLength ); |
| 157 | std::string::iterator sit = path.begin(); |
| 158 | for ( SceneInterface::Path::const_iterator it = p.begin(); it != p.end(); it++ ) |
| 159 | { |
| 160 | *sit++ = '/'; |
| 161 | const std::string &str = it->value(); |
| 162 | path.replace( sit, sit + str.size(), str ); |
| 163 | sit += str.size(); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | void SceneInterface::stringToPath( const std::string &path, SceneInterface::Path &p ) |
| 168 | { |