Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

hyp.ker.command.h

00001 /*
00002 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
00003  Hyperion Pattern.
00004  Hyperion Pattern is a part of the Hyperion Project.
00005 ----------------------------------------------------------
00006  Copyright (c) 2001 Pierre Rebours.
00007 
00008  This library is free software; you can redistribute it and/or
00009  modify it under the terms of the GNU Lesser General Public
00010  License as published by the Free Software Foundation; either
00011  version 2.1 of the License, or (at your option) any later version.
00012 
00013  This library is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  
00017  See hyp.license.txt file for more information about the license.
00018  
00019  Web: http://lagrandeporte.multimania.com/hyperion
00020  Email: amtycho@yahoo.fr
00021 ----------------------------------------------------------
00022  CVS
00023  $Log$
00024 
00025  Creation 10/05/01 PR
00026 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
00027 */
00028 
00029 
00030 #ifndef _hyp_ker_command_h_
00031 #define _hyp_ker_command_h_
00032 
00033 #ifndef hyp_KERNEL_CORE_INSIDE
00034 #error Inclusion not allowed (include hyp.kernel.core.h instead)
00035 #endif
00036 
00037 
00038 class hyp_ker_DLL CCmdInfoArg
00039 {
00040 protected:
00041         static int m_Argc;
00042         static char** m_Argv;
00047         inline static void SetArg(int Argc,char** Argv) { m_Argc=Argc; m_Argv=Argv; }
00048 };
00049 
00050 
00051 template<class T>
00052 class CCmdInfoData :
00053 protected CCmdInfoArg
00054 {
00055 public:
00056         virtual int GetSize() const =0;
00057         virtual T GetValue(int) const =0;
00058 };
00059 
00060 class hyp_ker_DLL CCmdInfoLabel :
00061 public CCmdInfoData<std::string>
00062 {
00063         int m_PosBegin;         //postion du label
00064         int m_PosLast;  //position du label suivant
00065 public:
00066         CCmdInfoLabel(int =0,int =0);
00067         virtual int GetSize() const;
00068         virtual std::string GetValue(int) const;
00069 
00075         template<class T>
00076         void Get(T& Value,int Pos) const {
00077                 std::stringstream str_stream;
00078                 str_stream<<GetValue(Pos);
00079                 str_stream>>Value;
00080         }
00081 };
00082 
00083 
00084 class CCmdInfo;
00085 
00086 typedef std::vector<CCmdInfoLabel> t_CmdInfoLabelEnum;
00087 
00088 
00089 class hyp_ker_DLL CCmdInfoLabelEnum :
00090 public CCmdInfoData<CCmdInfoLabel>,
00091 public t_CmdInfoLabelEnum
00092 {
00093         std::string m_LabelName;
00094 public:
00095         CCmdInfoLabelEnum(const std::string&);
00096         virtual int GetSize() const;
00097         virtual CCmdInfoLabel GetValue(int) const;
00101         inline std::string GetLabelName() const { return m_LabelName; } 
00102 };
00103 
00104 
00105 class hyp_ker_DLL CCmdInfo :
00106 public CCmdInfoData<CCmdInfoLabelEnum>
00107 {
00108         const char m_LabelKey;
00109         
00110 public:
00111         CCmdInfo(int,char**,char ='-');
00112         virtual int GetSize(void) const;
00113         virtual CCmdInfoLabelEnum GetValue(int) const;  
00114         std::string GetModuleFileName() const;
00115         std::string GetModulePath() const;
00116         std::string GetModuleName() const;
00117         std::string GetLineOfParameters() const;
00118 
00119 private:
00120         int GetNextLabelPosition(int) const;
00121         std::string GetLabelName(int) const;
00122         int GetNextLabel(const std::string&,int) const;
00123 
00124         friend hyp_ker_DLL std::ostream& operator<<(std::ostream& ,const CCmdInfo&);
00125 };
00126 
00127 
00128 #endif

Top of Page
written by Pierre Rebours © 2000-2001. Terms of Use.