Index: trunk/FACT++/src/Converter.h
===================================================================
--- trunk/FACT++/src/Converter.h	(revision 10219)
+++ trunk/FACT++/src/Converter.h	(revision 10270)
@@ -9,39 +9,87 @@
 class Converter
 {
+public:
+    typedef std::pair<const std::type_info *, int> Type;
+    typedef std::pair<int, int>                    Offset;
+    typedef std::pair<Type, Offset>                Format;
+    typedef std::vector<Format>                    FormatList;
+
+    struct O { };
+    struct W { };
+
+    static std::string Clean(std::string s);
+
 private:
-    bool rc;                        /// Flag for the success of the conversion
-    std::ostream &wout;             /// ostream to which output is redirected
-    std::vector<char> data;         /// data storage
-    std::vector<boost::any> vec;    /// storage for typed data
+    std::ostream &wout;        /// ostream to which output is redirected
+
+    const std::string fFormat; /// Original format string
+    const FormatList  fList;   /// Compiled format description
+
+    template <class T>
+        T Get(std::stringstream &line) const;
+
+    bool        GetBool(std::stringstream &line) const;
+    std::string GetString(std::stringstream &line) const;
+    std::string GetStringEol(std::stringstream &line) const;
 
     template<class T>
-        void EvalImp(int i, std::stringstream &line, std::vector<char> &v, const T &val);
+        void GetBinImp(std::vector<char> &v, const T &val) const;
     template<class T>
-        void Eval(int i, std::stringstream &line, std::vector<char> &v);
-        void EvalBool(int i, std::stringstream &line, std::vector<char> &v);
-        void EvalString(int i, std::stringstream &line, std::vector<char> &v);
+        void GetBinImp(std::vector<boost::any> &v, const T &val) const;
+
+    void GetBinString(std::vector<char> &v, const std::string &val) const;
+    void GetBinString(std::vector<boost::any> &v, const std::string &val) const;
 
     template<class T>
-        std::string Get(const char *&data);
+        std::string GetString(const char *&data) const;
+
+    template<class T>
+        static Type GetType();
+    template<class T>
+        static Type GetVoid();
+
+    template <class T>
+        std::vector<T> Get(const std::string &str) const;
+    template <class T>
+        T Get(const void *d, int size) const;
+
+
+
+    template<class T>
+        void Add(std::string &str, const char* &ptr) const;
+    void AddString(std::string &str, const std::string &ptr) const;
+    template<class T>
+        void Add(std::vector<boost::any> &vec, const char* &ptr) const;
+    void AddString(std::vector<boost::any> &vec, const std::string &ptr) const;
+
 
 public:
-    Converter(std::ostream &out, const std::string &fmt, const std::string &str);
-    Converter(std::ostream &out, const std::string &fmt, const void *d, int size);
+    Converter(std::ostream &out, const std::string &fmt, bool strict=true);
+    Converter(const std::string &fmt, bool strict=true);
 
-    /// Returns whether the conversion was successfull
-    bool GetRc() const { return rc; }
+    /// @returns whether the interpreted format was valid but empty ("")
+    bool empty() const { return fList.size()==1 && fList.back().first.second==0; }
 
-    /// const Pointer to the data memory
-    const char *Ptr() const { return &*data.begin(); }
-    /// non-const Pointer to the data memory (for convinience using Dim)
-    char *Ptr() { return &*data.begin(); }
+    /// @returns whether the compilation was successfull
+    bool valid() const { return !fList.empty() && fList.back().first.second==0; }
 
-    /// Return the size of the data memory
-    int  Size() const { return data.size(); }
+    /// @returns true if the compilation failed
+    bool operator!() const { return !valid(); }
 
-    /// Return the data memory converted into a string (not necessarily \0-terminated)
-    const std::string Str() const { return std::string(&*data.begin(), data.size()); }
+    const FormatList &GetList() const { return fList; }
 
+    static FormatList Compile(std::ostream &out, const std::string &fmt, bool strict=false);
+    static FormatList Compile(const std::string &fmt, bool strict=false);
 
+    std::string             GetString(const void *d, int size) const;
+    std::vector<char>       GetVector(const void *d, int size) const;
+    std::vector<boost::any> GetAny(const void *d, int size) const;
+
+    std::vector<boost::any> GetAny(const std::string &str) const;
+    std::vector<char>       GetVector(const std::string &str) const;
+
+    static std::string GetHex(const void *d, int size);
+
+/*
     // Returns the number of entries in Converter:vec
     int N() const { return vec.size(); }
@@ -58,5 +106,5 @@
     template <class T>
         T At(int i) const { return boost::any_cast<T>(vec[i]); }
-
+*/
 
     static std::vector<std::string> Regex(const std::string &expr, const std::string &line);
