X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fengine%2FAny.hxx;h=f8d1e672fa6233d6b5b61e69aac1e5df0bae5ba2;hb=c9208a8ef7f32a620d9650908588320ff159a167;hp=cc9a51c9df6f5994f3b8fdf9cb9ce9ec74cb35b7;hpb=88c5f67088445931a1598331e1faae6df0145c0b;p=modules%2Fyacs.git diff --git a/src/engine/Any.hxx b/src/engine/Any.hxx index cc9a51c9d..f8d1e672f 100644 --- a/src/engine/Any.hxx +++ b/src/engine/Any.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2014 CEA/DEN, EDF R&D +// Copyright (C) 2006-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,6 +42,12 @@ namespace YACS class TypeCodeStruct; typedef void (*Deallocator)(void *); +#ifndef SWIG + YACSLIBENGINE_EXPORT std::string ToBase64(const std::string& bytes); + YACSLIBENGINE_EXPORT std::string FromBase64(const std::string& bytes); + YACSLIBENGINE_EXPORT std::string FromBase64Safe(const std::string& bytes); +#endif + class YACSLIBENGINE_EXPORT StringOnHeap { friend class Any; @@ -49,14 +55,17 @@ namespace YACS friend class ArrayAny; private: StringOnHeap(const char *val); + StringOnHeap(const char *val, std::size_t len); StringOnHeap(const std::string& val); StringOnHeap(char *val, Deallocator deAlloc); bool operator ==(const StringOnHeap& other) const; StringOnHeap *deepCopy() const; const char *cStr() const { return _str; } + std::size_t size() const { return _len; } ~StringOnHeap(); private: char *_str; + std::size_t _len; Deallocator _dealloc; }; @@ -91,7 +100,8 @@ namespace YACS Any(TypeCode* type); Any(const Any& other); virtual void putMyReprAtPlace(char *data) const = 0; - static AnyPtr buildAnyFromCoarseData(char *data, TypeCode* type); //Factory Method + //static AnyPtr buildAnyFromCoarseData(char *data, TypeCode* type); //Factory Method + static bool IsNull(char *data); protected: TypeCode* _type; }; @@ -101,6 +111,7 @@ namespace YACS class YACSLIBENGINE_EXPORT AtomAny : public Any { friend class TypeCode; + friend class TypeCodeObjref; union ValueContainer { @@ -114,6 +125,7 @@ namespace YACS template static AtomAny *New(T val) { return new AtomAny(val); } static AtomAny *New(char *val, Deallocator dealloc); + static AtomAny *New(const std::string& val, TypeCode *type); AnyPtr operator[](int i) const throw(Exception); AnyPtr operator[](const char *key) const throw(Exception); bool operator ==(const Any& other) const; @@ -121,6 +133,7 @@ namespace YACS bool getBoolValue() const throw(Exception); double getDoubleValue() const throw(Exception); std::string getStringValue() const throw(Exception); + const char *getBytesValue(std::size_t& len) const; protected: void putMyReprAtPlace(char *data) const; static void putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy); @@ -134,6 +147,7 @@ namespace YACS AtomAny(double val); AtomAny(const char *val); AtomAny(const std::string& val); + AtomAny(const std::string& val, TypeCode* type); AtomAny(const AtomAny& other); AtomAny(char *data, TypeCode* type); AtomAny(char *val, Deallocator deAlloc); @@ -162,6 +176,9 @@ namespace YACS void destroy(char *pt, const TypeCode *tc); void deallocate(char *pt); unsigned int size() const; + std::vector getSetItems() const; + public: + static const char DFT_CHAR_VAR; }; class YACSLIBENGINE_EXPORT ComposedAny : public Any @@ -201,6 +218,8 @@ namespace YACS static SequenceAny *New(const TypeCode *typeOfContent, unsigned lgth); template static SequenceAny *New(T *val, unsigned int lgth, Deallocator deAlloc); + std::vector getSetItems() const { return _alloc.getSetItems(); } + SequenceAny *removeUnsetItemsFromThis() const; protected: void putMyReprAtPlace(char *data) const; static void putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy);