Qore Programming Language - C/C++ Library  0.8.13.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TypedHashDecl.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  TypedHashDecl.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2003 - 2017 Qore Technologies, s.r.o.
8 
9  Permission is hereby granted, free of charge, to any person obtaining a
10  copy of this software and associated documentation files (the "Software"),
11  to deal in the Software without restriction, including without limitation
12  the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  and/or sell copies of the Software, and to permit persons to whom the
14  Software is furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in
17  all copies or substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  DEALINGS IN THE SOFTWARE.
26 
27  Note that the Qore library is released under a choice of three open-source
28  licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
29  information.
30 */
31 
32 #ifndef _QORE_TYPEDHASHDECL_H
33 
34 #define _QORE_TYPEDHASHDECL_H
35 
36 // forward references
37 class typed_hash_decl_private;
38 
40 
43  friend class typed_hash_decl_private;
44 
45 public:
46  DLLEXPORT TypedHashDecl(const char* name);
47 
48  DLLEXPORT TypedHashDecl(const TypedHashDecl& old);
49 
51  DLLEXPORT const QoreTypeInfo* getTypeInfo(bool or_nothing = false) const;
52 
54  DLLEXPORT void addMember(const char* name, const QoreTypeInfo* memberTypeInfo, QoreValue init_val);
55 
56  DLLEXPORT const char* getName() const;
57 
58  DLLEXPORT bool isSystem() const;
59 
60 protected:
62  DLLEXPORT ~TypedHashDecl();
63 
64 private:
65  DLLEXPORT TypedHashDecl(typed_hash_decl_private* p);
66 
67  typed_hash_decl_private* priv;
68 };
69 
71 
74 public:
76  DLLLOCAL TypedHashDeclHolder(TypedHashDecl* thd) : thd(thd) {
77  }
78 
80  DLLEXPORT ~TypedHashDeclHolder();
81 
83  DLLLOCAL TypedHashDecl* operator*() const {
84  return thd;
85  }
86 
88  DLLLOCAL TypedHashDecl* operator->() const {
89  return thd;
90  }
91 
93  DLLLOCAL TypedHashDecl* operator=(TypedHashDecl* nhd);
94 
96  DLLLOCAL TypedHashDecl* release() {
97  auto rv = thd;
98  thd = nullptr;
99  return rv;
100  }
101 
102 private:
104  TypedHashDecl* thd;
105 };
106 
108 DLLEXPORT extern const TypedHashDecl* hashdeclStatInfo;
109 
111 DLLEXPORT extern const TypedHashDecl* hashdeclDirStatInfo;
112 
114 DLLEXPORT extern const TypedHashDecl* hashdeclFilesystemInfo;
115 
117 DLLEXPORT extern const TypedHashDecl* hashdeclDateTimeInfo;
118 
120 DLLEXPORT extern const TypedHashDecl* hashdeclIsoWeekInfo;
121 
123 DLLEXPORT extern const TypedHashDecl* hashdeclCallStackInfo;
124 
126 DLLEXPORT extern const TypedHashDecl* hashdeclExceptionInfo;
127 
129 DLLEXPORT extern const TypedHashDecl* hashdeclStatementInfo;
130 
131 #endif
DLLEXPORT ~TypedHashDecl()
deletes the object and frees all memory
DLLLOCAL TypedHashDeclHolder(TypedHashDecl *thd)
creates the object
Definition: TypedHashDecl.h:76
DLLLOCAL TypedHashDecl * operator->() const
implicit conversion to TypedHashDecl*
Definition: TypedHashDecl.h:88
DLLLOCAL TypedHashDecl * operator*() const
implicit conversion to TypedHashDecl*
Definition: TypedHashDecl.h:83
allows for temporary storage of a TypedHashDecl pointer
Definition: TypedHashDecl.h:73
DLLLOCAL TypedHashDecl * release()
releases the TypedHashDecl*
Definition: TypedHashDecl.h:96
DLLEXPORT void addMember(const char *name, const QoreTypeInfo *memberTypeInfo, QoreValue init_val)
adds an element to a built-in hashdecl
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:112
DLLEXPORT ~TypedHashDeclHolder()
deletes the TypedHashDecl object if still managed
typed hash declaration
Definition: TypedHashDecl.h:42
DLLEXPORT const QoreTypeInfo * getTypeInfo(bool or_nothing=false) const
returns the type info object for the hashdecl
DLLLOCAL TypedHashDecl * operator=(TypedHashDecl *nhd)
assign new TypedHashDecl value; any managed object is deleted if still managed