|
dvander@2808
|
1 |
/** |
|
dvander@2808
|
2 |
* vim: set ts=4 sw=4 tw=99 noet : |
|
dvander@2808
|
3 |
* ============================================================================= |
|
dvander@2808
|
4 |
* SourceMod |
|
ds@3099
|
5 |
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved. |
|
dvander@2808
|
6 |
* ============================================================================= |
|
dvander@2808
|
7 |
* |
|
dvander@2808
|
8 |
* This program is free software; you can redistribute it and/or modify it under |
|
dvander@2808
|
9 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
dvander@2808
|
10 |
* Free Software Foundation. |
|
dvander@2808
|
11 |
* |
|
dvander@2808
|
12 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
dvander@2808
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
dvander@2808
|
14 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
dvander@2808
|
15 |
* details. |
|
dvander@2808
|
16 |
* |
|
dvander@2808
|
17 |
* You should have received a copy of the GNU General Public License along with |
|
dvander@2808
|
18 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
dvander@2808
|
19 |
* |
|
dvander@2808
|
20 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
dvander@2808
|
21 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
dvander@2808
|
22 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
dvander@2808
|
23 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
dvander@2808
|
24 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
dvander@2808
|
25 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
dvander@2808
|
26 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
dvander@2808
|
27 |
* or <http://www.sourcemod.net/license.php>. |
|
dvander@2808
|
28 |
* |
|
dvander@2808
|
29 |
* Version: $Id$ |
|
dvander@2808
|
30 |
*/ |
|
dvander@2808
|
31 |
#ifndef _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_ |
|
dvander@2808
|
32 |
#define _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_ |
|
dvander@2808
|
33 |
|
|
ds@3099
|
34 |
#if SOURCE_ENGINE >= SE_LEFT4DEAD |
|
dvander@2808
|
35 |
class ConCommandBaseIterator |
|
dvander@2808
|
36 |
{ |
|
dvander@2808
|
37 |
public: |
|
ds@3099
|
38 |
inline ConCommandBaseIterator() : iter(icvar) |
|
dvander@2808
|
39 |
{ |
|
ds@3099
|
40 |
iter.SetFirst(); |
|
dvander@2808
|
41 |
} |
|
dvander@2808
|
42 |
|
|
dvander@2808
|
43 |
inline bool IsValid() |
|
dvander@2808
|
44 |
{ |
|
ds@3099
|
45 |
return iter.IsValid(); |
|
dvander@2808
|
46 |
} |
|
dvander@2808
|
47 |
|
|
dvander@2808
|
48 |
inline void Next() |
|
dvander@2808
|
49 |
{ |
|
ds@3099
|
50 |
iter.Next(); |
|
dvander@2808
|
51 |
} |
|
dvander@2808
|
52 |
|
|
dvander@2808
|
53 |
inline ConCommandBase *Get() |
|
dvander@2808
|
54 |
{ |
|
ds@3099
|
55 |
return iter.Get(); |
|
ds@3099
|
56 |
} |
|
ds@3099
|
57 |
private: |
|
ds@3099
|
58 |
ICvar::Iterator iter; |
|
ds@3099
|
59 |
}; |
|
dvander@2808
|
60 |
#else |
|
ds@3099
|
61 |
class ConCommandBaseIterator |
|
ds@3099
|
62 |
{ |
|
ds@3099
|
63 |
public: |
|
ds@3099
|
64 |
inline ConCommandBaseIterator() |
|
ds@3099
|
65 |
{ |
|
ds@3099
|
66 |
iter = icvar->GetCommands(); |
|
ds@3099
|
67 |
} |
|
ds@3099
|
68 |
|
|
ds@3099
|
69 |
inline bool IsValid() |
|
ds@3099
|
70 |
{ |
|
ds@3099
|
71 |
return iter != NULL; |
|
ds@3099
|
72 |
} |
|
ds@3099
|
73 |
|
|
ds@3099
|
74 |
inline void Next() |
|
ds@3099
|
75 |
{ |
|
ds@3099
|
76 |
iter = const_cast<ConCommandBase *>(iter->GetNext()); |
|
ds@3099
|
77 |
} |
|
ds@3099
|
78 |
|
|
ds@3099
|
79 |
inline ConCommandBase *Get() |
|
ds@3099
|
80 |
{ |
|
ds@3099
|
81 |
return iter; |
|
ds@3099
|
82 |
} |
|
ds@3099
|
83 |
private: |
|
ds@3099
|
84 |
ConCommandBase *iter; |
|
ds@3099
|
85 |
}; |
|
dvander@2808
|
86 |
#endif |
|
dvander@2808
|
87 |
|
|
dvander@2808
|
88 |
#endif /* _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_ */ |
|
dvander@2808
|
89 |
|