cmt_fragment.h Source File

Main Page Class Hierarchy Compound List File List Compound Members File Members

# cmt_fragment.h

Go to the documentation of this file.

    00001 #ifndef __cmt_fragment_h__
    00002 #define __cmt_fragment_h__
    00003
    00004 #include <stdarg.h>
    00005
    00006 #include "cmt_parser.h"
    00007 #include "cmt_system.h"
    00008
    00009 class Variable
    00010 {
    00011 public:
    00012
    00013   typedef cmt_vector<Variable> VariableVector;
    00014
    00015   static Variable* find (VariableVector& vector,
    00016                          const cmt_string& name);
    00017
    00018 public:
    00019
    00020   Variable ();
    00021   Variable (const cmt_string& n);
    00022
    00023   const cmt_string& macro_braces () const;
    00024   const cmt_string& macro_pars () const;
    00025
    00026   void set (const cmt_string& new_name,
    00027             const cmt_string& new_value = "");
    00028
    00029   Variable& operator = (const Variable& other);
    00030   Variable& operator = (const cmt_string& v);
    00031   void operator += (const cmt_string& v);
    00032   cmt_string operator + (const cmt_string& v) const;
    00033   operator const cmt_string& () const;
    00034   bool operator == (const cmt_string& v) const;
    00035   bool operator != (const cmt_string& v) const;
    00036   cmt_string name;
    00037   cmt_string value;
    00038
    00039 private:
    00040   cmt_string m_macro_braces;
    00041   cmt_string m_macro_pars;
    00042 };
    00043
    00044 class Fragment
    00045 {
    00046 public:
    00047   typedef cmt_vector<Fragment> FragmentVector;
    00048
    00049   static void action (const CmtSystem::cmt_string_vector& words,
    00050                       Use* use);
    00051   static Fragment* find (const cmt_string& name);
    00052   static void add (const cmt_string& name,
    00053                    const cmt_string& suffix,
    00054                    const cmt_string& header,
    00055                    const cmt_string& trailer,
    00056                    bool need_dependencies,
    00057                    Use* use);
    00058   static void show (const cmt_string& name);
    00059   static void show_all ();
    00060   static void clear_all ();
    00061   static bool copy (FILE* out, const cmt_string& name, int variables, ...);
    00062   static bool copy (cmt_string& out, const cmt_string& name, int variables, ...);
    00063   static bool copy (FILE* out, const cmt_string& name,
    00064                     const Variable::VariableVector& vector, int variables, ...);
    00065   static bool copy (cmt_string& out, const cmt_string& name,
    00066                     const Variable::VariableVector& vector, int variables, ...);
    00067
    00068   static FragmentVector& fragments ();
    00069
    00070 public:
    00071   Fragment ();
    00072   Fragment (const cmt_string& fragment_name);
    00073   ~Fragment ();
    00074   void clear ();
    00075   int print ();
    00076   bool locate ();
    00077
    00078   bool copy (FILE* out, int variables, ...);
    00079   bool copy (cmt_string& out, int variables, ...);
    00080   bool copy (FILE* out, int variables, va_list ids);
    00081   bool copy (cmt_string& out, int variables, va_list ids);
    00082   bool wincopy (FILE* out, int variables, va_list ids);
    00083   bool wincopy (cmt_string& out, int variables, va_list ids);
    00084
    00085   bool copy (FILE* out, const Variable::VariableVector& vector, int variables, ...);
    00086   bool copy (cmt_string& out, const Variable::VariableVector& vector, int variables, ...);
    00087   bool copy (FILE* out, const Variable::VariableVector& vector, int variables, va_list ids);
    00088   bool copy (cmt_string& out, const Variable::VariableVector& vector, int variables, va_list ids);
    00089   bool wincopy (FILE* out, const Variable::VariableVector& vector, int variables, va_list ids);
    00090   bool wincopy (cmt_string& out, const Variable::VariableVector& vector, int variables, va_list ids);
    00091
    00092   cmt_string name;
    00093   cmt_string suffix;
    00094   cmt_string header;
    00095   cmt_string trailer;
    00096   bool need_dependencies;
    00097   cmt_string path;
    00098   UseRef use;
    00099 };
    00100
    00101 class FragmentHandle
    00102 {
    00103 public:
    00104   FragmentHandle ();
    00105   FragmentHandle (const cmt_string name);
    00106
    00107   FragmentHandle& operator = (const FragmentHandle& other);
    00108   void reset ();
    00109   void set (const cmt_string name);
    00110   cmt_string& name ();
    00111   cmt_string& suffix ();
    00112   cmt_string& header ();
    00113   cmt_string& trailer ();
    00114   bool need_dependencies ();
    00115
    00116   bool copy (FILE* out, int variables, ...);
    00117   bool copy (cmt_string& out, int variables, ...);
    00118   bool wincopy (FILE* out, int variables, ...);
    00119   bool wincopy (cmt_string& out, int variables, ...);
    00120
    00121   bool copy (FILE* out, const Variable::VariableVector& vector, int variables, ...);
    00122   bool copy (cmt_string& out, const Variable::VariableVector& vector, int variables, ...);
    00123   bool wincopy (FILE* out, const Variable::VariableVector& vector, int variables, ...);
    00124   bool wincopy (cmt_string& out, const Variable::VariableVector& vector, int variables, ...);
    00125
    00126 private:
    00127   bool setup ();
    00128
    00129   Fragment* _fragment;
    00130   cmt_string _name;
    00131   bool _initialized;
    00132 };
    00133
    00134 #endif