OpenNet
SourceCode.h
Aller à la documentation de ce fichier.
1 
2 // Product OpenNet
3 
8 
9 #pragma once
10 
11 // Includes
13 
14 // ===== Includes ===========================================================
15 #include <OpenNet/OpenNet.h>
16 #include <OpenNet/Status.h>
17 
18 namespace OpenNet
19 {
20 
21  // Class
23 
30  class SourceCode
31  {
32 
33  public:
34 
41  OPEN_NET_PUBLIC SourceCode();
42 
49  OPEN_NET_PUBLIC virtual ~SourceCode();
50 
67  OPEN_NET_PUBLIC Status AppendCode(const char * aFileName);
68 
82  OPEN_NET_PUBLIC virtual Status AppendCode(const char * aCode, unsigned int aCodeSize_byte);
83 
95  OPEN_NET_PUBLIC Status AppendCode(const SourceCode & aCode);
96 
105  OPEN_NET_PUBLIC unsigned int GetCodeSize() const;
106 
116  OPEN_NET_PUBLIC const char * GetName() const;
117 
126  OPEN_NET_PUBLIC virtual Status ResetCode();
127 
140  OPEN_NET_PUBLIC virtual Status SetArgumentCount(unsigned int aArgCount);
141 
158  OPEN_NET_PUBLIC virtual Status SetCode(const char * aFileName);
159 
173  OPEN_NET_PUBLIC virtual Status SetCode(const char * aCode, unsigned int aCodeSize_byte);
174 
185  OPEN_NET_PUBLIC Status SetName(const char * aName);
186 
197  OPEN_NET_PUBLIC virtual Status Display(FILE * aOut) const;
198 
210  OPEN_NET_PUBLIC virtual unsigned int Edit_Remove(const char * aSearch);
211 
227  OPEN_NET_PUBLIC virtual unsigned int Edit_Replace(const char * aSearch, const char * aReplace);
228 
240  OPEN_NET_PUBLIC unsigned int Edit_Search(const char * aSearch);
241 
242  // internal:
243 
244  unsigned int GetArgumentCount() const;
245  const char * GetCode() const;
246 
247  protected:
248 
249  char * mCode ;
250  unsigned int mCodeSize_byte;
251 
252  private:
253 
254  SourceCode(const SourceCode &);
255 
256  const SourceCode & operator = (const SourceCode &);
257 
258  unsigned int Edit_Replace_ByEqual (const char * aSearch, const char * aReplace, unsigned int aLength);
259  unsigned int Edit_Replace_ByLonger (const char * aSearch, const char * aReplace, unsigned int aSearchLength, unsigned int aReplaceLength);
260  unsigned int Edit_Replace_ByShorter(const char * aSearch, const char * aReplace, unsigned int aSearchLength, unsigned int aReplaceLength);
261 
262  void ReleaseCode();
263 
264  char mArgumentCount;
265  char mName[64];
266 
267  };
268 
269 }
virtual OPEN_NET_PUBLIC Status ResetCode()
Reinitialiser le code.
virtual OPEN_NET_PUBLIC Status SetCode(const char *aFileName)
Assigner le code en utilisant un fichier source.
OPEN_NET_PUBLIC unsigned int GetCodeSize() const
Obtenir la taille du code.
virtual OPEN_NET_PUBLIC unsigned int Edit_Replace(const char *aSearch, const char *aReplace)
Remplacer des chaines dans le code.
Definition: Adapter.h:19
OPEN_NET_PUBLIC const char * GetName() const
Obtenir le nom de l'instance.
virtual OPEN_NET_PUBLIC unsigned int Edit_Remove(const char *aSearch)
Retirer des chaines du code.
La classe SourceCode.
Definition: SourceCode.h:30
virtual OPEN_NET_PUBLIC Status SetArgumentCount(unsigned int aArgCount)
Assigner un nombre d'argument à passer à la fonction ou au kernel.
virtual OPEN_NET_PUBLIC ~SourceCode()
Destructeur.
OPEN_NET_PUBLIC Status AppendCode(const char *aFileName)
Ajouter du code en utilisant un fichier source.
OPEN_NET_PUBLIC Status SetName(const char *aName)
Assigner le nom de l'instance.
OPEN_NET_PUBLIC unsigned int Edit_Search(const char *aSearch)
Rechercher une chaines dans le code.
virtual OPEN_NET_PUBLIC Status Display(FILE *aOut) const
Afficher.
OPEN_NET_PUBLIC SourceCode()
Constructeur.