66 extern std::vector<std::string> PluginLibs;
67 extern std::vector<std::string> PluginActions;
68 extern std::map<std::string, std::vector <std::string> > PluginArgs;
71 void processPluginCommandLine(std::vector<std::string>& input_argv);
73 int obtainAndExecuteActions(
SgProject* n);
81 virtual bool ParseArgs(
const std::vector<std::string> &arg) {
return true; };
90 template <
typename IteratorT>
92 IteratorT begin_iterator, end_iterator;
97 template <
typename Container>
100 : begin_iterator(c.begin()), end_iterator(c.end()) {}
102 : begin_iterator(begin_iterator),
103 end_iterator(end_iterator) {}
105 IteratorT begin()
const {
return begin_iterator; }
106 IteratorT end()
const {
return end_iterator; }
117 template <
typename T> iterator_range<T>
make_range(std::pair<T, T> p) {
118 return iterator_range<T>(p.first, p.second);
122 iterator_range<decltype(begin(std::declval<T>()))> drop_begin(T &&t,
int n) {
123 return make_range(std::next(begin(t), n), end(t));
129 template <
typename T>
131 const char *Name, *Desc;
136 : Name(N), Desc(D), Ctor(C)
139 const char *getName()
const {
return Name; }
140 const char *getDesc()
const {
return Desc; }
141 T* instantiate()
const {
return Ctor(); }
147 template <
typename T>
157 static const char *
nameof(
const entry &Entry) {
return Entry.getName(); }
158 static const char *descof(
const entry &Entry) {
return Entry.getDesc(); }
164 template <
typename T,
typename U = RegistryTraits<T> >
168 typedef typename U::entry entry;
178 static void Announce(
const entry &E) {
179 for (
listener *Cur = ListenerHead; Cur; Cur = Cur->Next)
184 static node *Head, *Tail;
187 static listener *ListenerHead, *ListenerTail;
199 node(
const entry& V) : Next(NULL), Val(V) {
218 bool operator==(
const iterator &That)
const {
return Cur == That.Cur; }
219 bool operator!=(
const iterator &That)
const {
return Cur != That.Cur; }
220 iterator &operator++() { Cur = Cur->Next;
return *
this; }
221 const entry &operator*()
const {
return Cur->Val; }
222 const entry *operator->()
const {
return &Cur->Val; }
226 static iterator end() {
return iterator(NULL); }
228 static iterator_range<iterator> entries() {
251 friend void Registry::Announce(
const entry &E);
261 for (
iterator I = begin(), E = end(); I != E; ++I)
266 listener() : Prev(ListenerTail), Next(NULL) {
274 virtual ~listener() {
302 template <
typename V>
307 static T* CtorFn() {
return new V(); }
310 Add(
const char *Name,
const char *Desc)
311 : Entry(Name, Desc, CtorFn), Node(Entry) {}
320 template <
typename T,
typename U>
323 template <
typename T,
typename U>
326 template <
typename T,
typename U>
329 template <
typename T,
typename U>