property.h

00001 #ifndef PROPERTY_H
00002 #define PROPERTY_H
00003 
00004 /*
00005   nettyping のプロパティ情報管理
00006   Satofumi KAMIMURA
00007   $Id$
00008 */
00009 
00010 #include "nettyping.h"
00011 #include <libxml/xmlreader.h>
00012 #include <string>
00013 #include <vector>
00014 
00015 
00016 class Property {
00017   std::string loaded_file;
00018   int selected_index;
00019 
00020   typedef struct {
00021     bool fullscreen;
00022     unsigned int user_index;
00023   } sysInfo_t;
00024 
00025   typedef struct {
00026     int type;
00027     int depth;
00028     const xmlChar* tag;
00029     const xmlChar* value;
00030   } xml_t;
00031   const xmlChar* pre_tag;
00032 
00033   bool readXMLLine(xml_t& xml, xmlTextReaderPtr reader);
00034   void readSysInfo(xmlTextReaderPtr reader);
00035   void readAllUserInfo(xmlTextReaderPtr reader);
00036 
00037 public:
00038   enum {
00039     UsersNumOver = -1,
00040     InvalidName = -2,
00041     AlreadyExist = -3,
00042   };
00043   sysInfo_t sys;
00044 
00045   class userInfo_t {
00046   public:
00047     userInfo_t(void)
00048       : practice_num(6), roman_convert(true), auto_next(false),
00049         learn_mode(true), send_ranking(false) {}
00050     std::string name;
00051     int practice_num;
00052     bool roman_convert;
00053     bool auto_next;
00054     bool learn_mode;
00055     bool send_ranking;
00056     std::string rank_page;
00057   };
00058   std::vector<userInfo_t> users;
00059   userInfo_t* user;
00060 
00061   Property(void);
00062   ~Property(void);
00063 
00064   bool load(const char* file, const char* path[]);
00065   bool save(const char* file = NULL);
00066 
00067   int addUser(const char* name = "guest");
00068   void delUser(unsigned int index);
00069   void setUserIndex(unsigned int index);
00070 };
00071 
00072 #endif /* !PROPERTY_H */
00073 

Generated on Mon Apr 13 22:52:03 2009 by  doxygen 1.5.7.1