Collaboration diagram for use_action_iterator:
Public Member Functions | |
use_action_iterator () | |
void | set (const cmt_string &w) |
bool | ok () |
Use * | get_use (Use *parent) |
Build or retreive the Use object corresponding to the parsed specification. | |
Private Types | |
enum | { need_package, need_version, need_path, need_version_alias, need_path_alias, finished } |
Private Attributes | |
enum use_action_iterator:: { ... } | state |
State | auto_imports |
cmt_string | package |
cmt_string | version |
cmt_string | path |
cmt_string | version_alias |
cmt_string | path_alias |
It maintains the results of the parsing in terms of a package name, a version, a path, and state variables (no_auto_imports)
Definition at line 572 of file cmt_use.cxx.
|
Definition at line 826 of file cmt_use.cxx.
00827 { 00828 need_package, 00829 need_version, 00830 need_path, 00831 need_version_alias, 00832 need_path_alias, 00833 finished 00834 } state; |
|
Definition at line 576 of file cmt_use.cxx. References auto_imports, need_package, state, and Unspecified.
00577 { 00578 state = need_package; 00579 auto_imports = Unspecified; 00580 } |
|
Build or retreive the Use object corresponding to the parsed specification. Now do create or retreive the Use object. Do not continue the operations for private uses accessed from an external context. Exceptions should be considered for
"auto_imports" is the state which is specified on the use statement currently being parsed. Warning : this Use had been previously specified as -no_auto_imports Now this new specification tries to turn it to auto_imports. It will be required to propagate the change, according to the specifications: for all sub_uses: if it is unspecified OR specified as auto_imports: turn it to auto_imports Definition at line 643 of file cmt_use.cxx. References ActionType, Use::add(), Use::auto_imports, auto_imports, UseContext::current(), Use::current(), finished, Cmt::get_action(), UseContext::get_current_auto_imports(), Use::get_current_scope(), Cmt::get_debug(), Use::get_index(), Use::get_ordered_uses(), Use::get_package(), Use::get_package_name(), Cmt::get_scope_filtering_mode(), need_package, need_path, need_path_alias, need_version, need_version_alias, Off, On, package, path, path_alias, reach_private_uses, Use::reorder(), ScopePrivate, Use::set_auto_imports(), UseContext::set_current(), show_packages(), cmt_vector< T >::size(), state, Unspecified, Use::UsePtrVector, version, and version_alias. Referenced by Use::action().
00644 { 00645 static Use::UsePtrVector& uses = Use::get_ordered_uses (); 00646 00647 if (version == "") version = "*"; 00648 00649 if (Cmt::get_debug ()) 00650 { 00651 int i; 00652 00653 cout << "use::action1> current=" << parent->get_package_name () << 00654 " package=" << package << " "; 00655 00656 for (i = 0; i < uses.size (); i++) 00657 { 00658 Use* u = uses[i]; 00659 cout << u->get_package_name () << " "; 00660 } 00661 cout << endl; 00662 } 00663 00664 const Use& cu = Use::current (); 00665 00675 ActionType action = Cmt::get_action (); 00676 00677 if (Cmt::get_debug ()) 00678 { 00679 cout << "before adding " << package <<"> auto_imports=" << auto_imports 00680 << " (current AI was " << UseContext::get_current_auto_imports () << ")" 00681 << " (Use::scope=" << parent->get_current_scope () << ")" 00682 << " (parent=" << parent->get_package_name () << ")" 00683 << endl; 00684 } 00685 00686 bool hidden_by_scope = false; 00687 00688 if (parent->get_current_scope () == ScopePrivate) 00689 { 00690 hidden_by_scope = true; 00691 00692 // Do not hide immediate children of the current package. 00693 if ((parent == 0) || 00694 (parent->get_package () == cu.get_package ())) hidden_by_scope = false; 00695 00696 // Override default rule according to the scope filtering mode. 00697 00698 if (Cmt::get_scope_filtering_mode () == reach_private_uses) hidden_by_scope = false; 00699 } 00700 00701 if (hidden_by_scope) 00702 { 00703 return (0); 00704 } 00705 00706 // Here the version may contain wild cards 00707 00708 UseContext save = UseContext::current (); 00709 00714 switch (auto_imports) 00715 { 00716 case Unspecified: 00717 00718 // unspecified => we forward the state saved in the current use context 00719 00720 UseContext::set_current (UseContext::get_current_auto_imports ()); 00721 break; 00722 case Off: 00723 00724 // off => the context becomes constrained to be off 00725 00726 UseContext::set_current (Off); 00727 break; 00728 case On: 00729 00730 // on => if current context is off it is kept off 00731 // otherwise it is forced to on 00732 00733 if (UseContext::get_current_auto_imports () != Off) 00734 { 00735 UseContext::set_current (On); 00736 } 00737 break; 00738 } 00739 00740 if (Cmt::get_debug ()) 00741 { 00742 cout << "about to add " << package << endl; 00743 show_packages (); 00744 } 00745 00747 Use* new_use = Use::add (path, package, version, 00748 version_alias, path_alias, parent, 00749 auto_imports); 00750 00751 if (new_use != 0) 00752 { 00753 if (Cmt::get_debug ()) 00754 { 00755 cout << "after adding1 " << package 00756 << "> auto_imports=" << new_use->auto_imports << endl; 00757 00758 show_packages (); 00759 } 00760 00761 switch (new_use->auto_imports) 00762 { 00763 case Unspecified: 00764 new_use->auto_imports = UseContext::get_current_auto_imports (); 00765 if (new_use->auto_imports == Unspecified) 00766 { 00767 new_use->auto_imports = On; 00768 } 00769 break; 00770 case On: 00771 break; 00772 case Off: 00773 if (UseContext::get_current_auto_imports () == On) 00774 { 00786 new_use->set_auto_imports (On); 00787 } 00788 break; 00789 } 00790 00791 00792 if (Cmt::get_debug ()) 00793 { 00794 cout << "after adding2 " << package 00795 << "> auto_imports=" << new_use->auto_imports << " "; 00796 cout << endl; 00797 } 00798 00799 UseContext& c = UseContext::current (); 00800 c = save; 00801 00802 Use::reorder (new_use, parent); 00803 00804 if (Cmt::get_debug ()) 00805 { 00806 cout << "use::action2> current=" << parent->get_package_name () 00807 << " package=" << package << " "; 00808 00809 int i; 00810 00811 for (i = 0; i < uses.size (); i++) 00812 { 00813 Use* u = uses[i]; 00814 cout << u->get_package_name () << "[" << u->get_index () << "]" << " "; 00815 } 00816 00817 cout << endl; 00818 } 00819 } 00820 00821 return (new_use); 00822 } |
|
Definition at line 628 of file cmt_use.cxx. References CmtSystem::is_home_package(), CmtSystem::is_project_package(), and CmtSystem::is_user_context_package(). Referenced by Use::action().
00629 { 00630 if (package == "") return (false); 00631 if (CmtSystem::is_home_package (package, version)) return (false); 00632 if (CmtSystem::is_user_context_package (package, version)) return (false); 00633 if (CmtSystem::is_project_package (package, version)) return (false); 00634 00635 return (true); 00636 } |
|
Definition at line 582 of file cmt_use.cxx. References auto_imports, cmt_string::erase(), need_package, need_version_alias, Off, On, and state. Referenced by Use::action().
00583 { 00584 if (w == "-auto_imports") 00585 { 00586 auto_imports = On; 00587 } 00588 else if (w == "-no_auto_imports") 00589 { 00590 auto_imports = Off; 00591 } 00592 else if (w == "|") 00593 { 00594 state = need_version_alias; 00595 } 00596 else 00597 { 00598 switch (state) 00599 { 00600 case need_package: 00601 package = w; 00602 state = need_version; 00603 break; 00604 case need_version: 00605 version = w; 00606 state = need_path; 00607 break; 00608 case need_path: 00609 path = w; 00610 while (path[path.size() - 1] == '/') path.erase (path.size() - 1); 00611 while (path[path.size() - 1] == '\\') path.erase (path.size() - 1); 00612 state = finished; 00613 break; 00614 case need_version_alias: 00615 version_alias = w; 00616 state = need_path_alias; 00617 break; 00618 case need_path_alias: 00619 path_alias = w; 00620 while (path_alias[path_alias.size() - 1] == '/') path_alias.erase (path_alias.size() - 1); 00621 while (path_alias[path_alias.size() - 1] == '\\') path_alias.erase (path_alias.size() - 1); 00622 state = finished; 00623 break; 00624 } 00625 } 00626 } |
|
Definition at line 836 of file cmt_use.cxx. Referenced by get_use(), set(), and use_action_iterator(). |
|
Definition at line 838 of file cmt_use.cxx. Referenced by get_use(). |
|
Definition at line 840 of file cmt_use.cxx. Referenced by get_use(). |
|
Definition at line 842 of file cmt_use.cxx. Referenced by get_use(). |
|
Referenced by get_use(), set(), and use_action_iterator(). |
|
Definition at line 839 of file cmt_use.cxx. Referenced by get_use(). |
|
Definition at line 841 of file cmt_use.cxx. Referenced by get_use(). |