initial load of upstream version 1.06.32
[xmlrpc-c] / tools / xml-rpc-api2cpp / DataType.hpp
diff --git a/tools/xml-rpc-api2cpp/DataType.hpp b/tools/xml-rpc-api2cpp/DataType.hpp
new file mode 100644 (file)
index 0000000..b5cab35
--- /dev/null
@@ -0,0 +1,43 @@
+#include <string>
+#include <cassert>
+
+class DataType {
+    std::string mTypeName;
+
+    DataType(DataType const&) { assert(false); }
+    
+    DataType& operator= (DataType const&) {
+        assert(false);
+        return *this;
+    }
+
+public:
+    DataType(const std::string& type_name) : mTypeName(type_name) {}
+
+    virtual ~DataType () {}
+
+    // Return the name for this XML-RPC type.
+    virtual std::string
+    typeName() const { return mTypeName; }
+
+    // Given a parameter position, calculate a unique base name for all
+    // parameter-related variables.
+    virtual std::string
+    defaultParameterBaseName(int position) const;
+
+    // Virtual functions for processing parameters.
+    virtual std::string
+    parameterFragment(std::string const& base_name) const = 0;
+
+    virtual std::string
+    inputConversionFragment(std::string const& base_name) const = 0;
+
+    // Virtual functions for processing return values.
+    virtual std::string
+    returnTypeFragment () const = 0;
+
+    virtual std::string
+    outputConversionFragment(std::string const& var_name) const = 0;
+};
+
+const DataType& findDataType(const std::string& name);