00001 #ifndef TYPELIB_LANG_C_CONTAINERS_HH
00002 #define TYPELIB_LANG_C_CONTAINERS_HH
00003
00004 #include <typelib/typemodel.hh>
00005
00006 class Vector : public Typelib::Container
00007 {
00008 bool is_memcpy;
00009 void resize(std::vector<uint8_t>* ptr, size_t new_size) const;
00010 void copy(std::vector<uint8_t>* dst_ptr, size_t dst_idx, std::vector<uint8_t>* src_ptr, size_t src_idx, size_t count) const;
00011 void erase(std::vector<uint8_t>* ptr, size_t idx) const;
00012 std::string getIndirectTypeName(std::string const& element_name) const;
00013
00014 public:
00015 static std::string fullName(std::string const& element_name);
00016 Vector(Typelib::Type const& on);
00017
00018 bool isRandomAccess() const;
00019 void setElement(void* ptr, int idx, Typelib::Value value) const;
00020 Typelib::Value getElement(void* ptr, int idx) const;
00021
00022 size_t getElementCount(void const* ptr) const;
00023 void init(void* ptr) const;
00024 void destroy(void* ptr) const;
00025 void clear(void*) const;
00026 long getNaturalSize() const;
00027 void push(void* ptr, Typelib::Value v) const;
00028 bool erase(void* ptr, Typelib::Value v) const;
00029 bool compare(void* ptr, void* other) const;
00030 void copy(void* dst, void* src) const;
00031 bool visit(void* ptr, Typelib::ValueVisitor& visitor) const;
00032 void delete_if_impl(void* ptr, DeleteIfPredicate& pred) const;
00033
00034 MarshalOps::const_iterator dump(
00035 void const* container_ptr, size_t element_count, Typelib::ValueOps::OutputStream& stream,
00036 MarshalOps::const_iterator const begin, MarshalOps::const_iterator const end) const;
00037
00038 MarshalOps::const_iterator load(
00039 void* container_ptr, size_t element_count,
00040 Typelib::ValueOps::InputStream& stream,
00041 MarshalOps::const_iterator const begin, MarshalOps::const_iterator const end) const;
00042
00043 static Container const& factory(Typelib::Registry& registry, std::list<Typelib::Type const*> const& on);
00044 ContainerFactory getFactory() const;
00045 };
00046
00047 class String : public Typelib::Container
00048 {
00049 public:
00050 String(Typelib::Registry const& registry);
00051
00052 size_t getElementCount(void const* ptr) const;
00053 void init(void* ptr) const;
00054 void destroy(void* ptr) const;
00055 void clear(void*) const;
00056
00057 long getNaturalSize() const;
00058
00059 void push(void* ptr, Typelib::Value v) const;
00060
00061 bool erase(void* ptr, Typelib::Value v) const;
00062
00063 bool compare(void* ptr, void* other) const;
00064
00065 void copy(void* dst, void* src) const;
00066
00067 bool visit(void* ptr, Typelib::ValueVisitor& visitor) const;
00068
00069 MarshalOps::const_iterator dump(
00070 void const* container_ptr, size_t element_count, Typelib::ValueOps::OutputStream& stream,
00071 MarshalOps::const_iterator const begin, MarshalOps::const_iterator const end) const;
00072
00073 MarshalOps::const_iterator load(
00074 void* container_ptr, size_t element_count,
00075 Typelib::ValueOps::InputStream& stream,
00076 MarshalOps::const_iterator const begin, MarshalOps::const_iterator const end) const;
00077
00078 void delete_if_impl(void* ptr, DeleteIfPredicate& pred) const;
00079
00080 static Container const& factory(Typelib::Registry& registry, std::list<Type const*> const& on);
00081 ContainerFactory getFactory() const;
00082
00083 static Type const& getElementType(Typelib::Registry const& registry);
00084
00085
00086 std::string getIndirectTypeName(std::string const& element_name) const { return ""; }
00087 void modifiedDependencyAliases(Typelib::Registry& registry) const {}
00088 };
00089
00090
00091 #endif
00092