00001 /* 00002 Copyright (c) 2007-2009 Takashi Kitao 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions 00007 are met: 00008 00009 1. Redistributions of source code must retain the above copyright 00010 ` notice, this list of conditions and the following disclaimer. 00011 00012 2. Redistributions in binary form must reproduce the above copyright 00013 ` notice, this list of conditions and the following disclaimer in the 00014 ` documentation and/or other materials provided with the distribution. 00015 00016 3. The name of the author may not be used to endorse or promote products 00017 ` derived from this software without specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00020 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00021 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00022 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 00023 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00025 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00026 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00027 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00028 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 */ 00030 00031 00032 class pgConf; 00033 00034 00039 class PG_API pgEnt 00040 { 00041 friend class pgConf; 00042 00043 public: 00044 static const u32 MAX_NAME_LENGTH = 20; 00045 00046 enum ValueType 00047 { 00048 TYPE_S32, // 00049 TYPE_R32, // 00050 TYPE_STRING 00051 }; 00052 00053 pgEnt* getPrevN() const; 00054 pgEnt* getNextN() const; 00055 00056 const pgStr<char, MAX_NAME_LENGTH>& getName() const; 00057 u16 getValueNum() const; 00058 ValueType getValueType(u16 index) const; 00059 s32 getValue_s32(u16 index) const; 00060 r32 getValue_r32(u16 index) const; 00061 const char* getValue_string(u16 index) const; 00062 00063 private: 00064 union Value 00065 { 00066 s32 val_s32; 00067 r32 val_r32; 00068 const char* val_str; 00069 }; 00070 00071 pgEnt(const char* name, u16 val_num, pgType<u8, ValueType>* val_type, Value* val); 00072 void operator=(const pgEnt&); 00073 00074 pgList<pgEnt>::Item m_item; 00075 pgStr<char, MAX_NAME_LENGTH> m_name; 00076 pgID m_name_id; 00077 u16 m_val_num; 00078 pgType<u8, ValueType>* m_val_type; 00079 Value* m_val; 00080 };
1.5.8