Rev | Line | |
---|
[170] | 1 | #include <jenga/include/smoothie/BasicFixed.h>
|
---|
| 2 | #include <jenga/include/smoothie/Smoothie.h>
|
---|
| 3 | #include <jenga/include/smoothie/Namespace.h>
|
---|
| 4 | #include <jenga/include/smoothie/SmoothieException.h>
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | NamespaceScopes::NamespaceScopes( const string &namespaceStr ){
|
---|
| 8 | if( namespaceStr.size() == 0 ){
|
---|
| 9 | return;
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | string::size_type i = 0;
|
---|
| 13 | while( true ){
|
---|
| 14 | string::size_type i2 = namespaceStr.find( '.', i );
|
---|
| 15 |
|
---|
| 16 | string tempName = namespaceStr.substr( i, i2-i );
|
---|
| 17 |
|
---|
| 18 | push_back( tempName );
|
---|
| 19 |
|
---|
| 20 | if( i2 == string::npos ){
|
---|
| 21 | break;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | i = i2 + 1;
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | void NamespaceScopesCollection::SplitNamespace( const char *fullName, char *namespaceStr, char *simpleName ) const
|
---|
| 29 | {
|
---|
| 30 | NamespaceScopes namespaceScopes( fullName );
|
---|
| 31 | bool hasSimpleName = false;
|
---|
| 32 | while( namespaceScopes.size() > 0 ){
|
---|
| 33 | if( IsExist( namespaceScopes ) ){
|
---|
| 34 | break;
|
---|
| 35 | }
|
---|
| 36 | namespaceScopes.pop_back();
|
---|
| 37 |
|
---|
| 38 | hasSimpleName = true;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | lstrcpy( namespaceStr, namespaceScopes.ToString().c_str() );
|
---|
| 42 |
|
---|
| 43 | bool hasNamespace = false;
|
---|
| 44 | if( namespaceStr[0] ){
|
---|
| 45 | hasNamespace = true;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | int dotLength = 0;
|
---|
| 49 | if( hasSimpleName && hasNamespace ){
|
---|
| 50 | dotLength = 1;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | lstrcpy( simpleName, fullName + lstrlen( namespaceStr ) + dotLength );
|
---|
| 54 | }
|
---|
| 55 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.