dvander@2808: /**
dvander@2808: * vim: set ts=4 sw=4 tw=99 noet :
dvander@2808: * =============================================================================
dvander@2808: * SourceMod
ds@3099: * Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
dvander@2808: * =============================================================================
dvander@2808: *
dvander@2808: * This program is free software; you can redistribute it and/or modify it under
dvander@2808: * the terms of the GNU General Public License, version 3.0, as published by the
dvander@2808: * Free Software Foundation.
dvander@2808: *
dvander@2808: * This program is distributed in the hope that it will be useful, but WITHOUT
dvander@2808: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dvander@2808: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
dvander@2808: * details.
dvander@2808: *
dvander@2808: * You should have received a copy of the GNU General Public License along with
dvander@2808: * this program. If not, see .
dvander@2808: *
dvander@2808: * As a special exception, AlliedModders LLC gives you permission to link the
dvander@2808: * code of this program (as well as its derivative works) to "Half-Life 2," the
dvander@2808: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
dvander@2808: * by the Valve Corporation. You must obey the GNU General Public License in
dvander@2808: * all respects for all other code used. Additionally, AlliedModders LLC grants
dvander@2808: * this exception to all derivative works. AlliedModders LLC defines further
dvander@2808: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
dvander@2808: * or .
dvander@2808: *
dvander@2808: * Version: $Id$
dvander@2808: */
dvander@2808: #ifndef _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
dvander@2808: #define _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
dvander@2808:
ds@3099: #if SOURCE_ENGINE >= SE_LEFT4DEAD
dvander@2808: class ConCommandBaseIterator
dvander@2808: {
dvander@2808: public:
ds@3099: inline ConCommandBaseIterator() : iter(icvar)
dvander@2808: {
ds@3099: iter.SetFirst();
dvander@2808: }
dvander@2808:
dvander@2808: inline bool IsValid()
dvander@2808: {
ds@3099: return iter.IsValid();
dvander@2808: }
dvander@2808:
dvander@2808: inline void Next()
dvander@2808: {
ds@3099: iter.Next();
dvander@2808: }
dvander@2808:
dvander@2808: inline ConCommandBase *Get()
dvander@2808: {
ds@3099: return iter.Get();
ds@3099: }
ds@3099: private:
ds@3099: ICvar::Iterator iter;
ds@3099: };
dvander@2808: #else
ds@3099: class ConCommandBaseIterator
ds@3099: {
ds@3099: public:
ds@3099: inline ConCommandBaseIterator()
ds@3099: {
ds@3099: iter = icvar->GetCommands();
ds@3099: }
ds@3099:
ds@3099: inline bool IsValid()
ds@3099: {
ds@3099: return iter != NULL;
ds@3099: }
ds@3099:
ds@3099: inline void Next()
ds@3099: {
ds@3099: iter = const_cast(iter->GetNext());
ds@3099: }
ds@3099:
ds@3099: inline ConCommandBase *Get()
ds@3099: {
ds@3099: return iter;
ds@3099: }
ds@3099: private:
ds@3099: ConCommandBase *iter;
ds@3099: };
dvander@2808: #endif
dvander@2808:
dvander@2808: #endif /* _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_ */
dvander@2808: