Line | |
---|
1 | #include "../common.h"
|
---|
2 |
|
---|
3 |
|
---|
4 | NamespaceScopes::NamespaceScopes( const char *namespaceStr ){
|
---|
5 | int i = 0;
|
---|
6 | while( namespaceStr[i] ){
|
---|
7 | char temporary[VN_SIZE];
|
---|
8 | for( int i2=0; ; i2++, i++ ){
|
---|
9 | if( namespaceStr[i] == '.' || namespaceStr[i] == '\0' ){
|
---|
10 | temporary[i2] = 0;
|
---|
11 | break;
|
---|
12 | }
|
---|
13 | temporary[i2] = namespaceStr[i];
|
---|
14 | }
|
---|
15 | push_back( temporary );
|
---|
16 |
|
---|
17 | if( namespaceStr[i] == '.' ){
|
---|
18 | i++;
|
---|
19 | }
|
---|
20 | }
|
---|
21 | }
|
---|
22 |
|
---|
23 | bool NamespaceScopes::IsLiving() const
|
---|
24 | {
|
---|
25 | if( IsBelong( *this, Smoothie::Lexical::liveingNamespaceScopes ) ){
|
---|
26 | return true;
|
---|
27 | }
|
---|
28 | return false;
|
---|
29 | }
|
---|
30 |
|
---|
31 | // 包括しているかをチェック
|
---|
32 | // 例:
|
---|
33 | // this = "Discoversoft.ActiveBasic"
|
---|
34 | // living = "Discoversoft.ActiveBasic"
|
---|
35 | // name = "ActiveBasic"
|
---|
36 | // この場合、living は name を包括している。
|
---|
37 | bool NamespaceScopes::IsCoverd( const string &name ) const
|
---|
38 | {
|
---|
39 | if( IsEqual( name ) ){
|
---|
40 | return true;
|
---|
41 | }
|
---|
42 |
|
---|
43 | string thisStr = ToString();
|
---|
44 |
|
---|
45 | NamespaceScopes tempLivingNamespaceScopes = Smoothie::Lexical::liveingNamespaceScopes;
|
---|
46 |
|
---|
47 | while( tempLivingNamespaceScopes.size() ){
|
---|
48 | NamespaceScopes tempNamespaceScopes = tempLivingNamespaceScopes;
|
---|
49 |
|
---|
50 | string tempStr = tempNamespaceScopes.ToString() + "." + name;
|
---|
51 | if( thisStr == tempStr ){
|
---|
52 | return true;
|
---|
53 | }
|
---|
54 |
|
---|
55 | tempLivingNamespaceScopes.pop_back();
|
---|
56 | }
|
---|
57 | return false;
|
---|
58 | }
|
---|
59 | bool NamespaceScopes::IsCoverd( const NamespaceScopes &namespaceScopes ) const
|
---|
60 | {
|
---|
61 | return IsCoverd( namespaceScopes.ToString() );
|
---|
62 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.