CodeSonar C++ API
[For improved navigation, enable JavaScript.]
cs_ir_boilerplate.hpp File Reference

Go to the source code of this file.

Macros

#define CS_CMP_COMPARATORS(cls)
 
#define CS_IR_BOILERPLATE(cls)
 
#define CS_IR_BOILERPLATE_FORWARD(cls, CTYPE, friends)
 
#define CS_IR_BOILERPLATE_FRIENDS(cls)
 
#define CS_IR_BOILERPLATE_FRIENDS_PLUS_OSTREAM(cls, cs)
 
#define CS_IR_BOILERPLATE_NONMEMBERS(cls, cs)
 
#define CS_IR_BOILERPLATE_TYPENAME(cls)
 

Macro Definition Documentation

◆ CS_CMP_COMPARATORS

#define CS_CMP_COMPARATORS (   cls)
Value:
SWIG_BUILD_ONLY( \
bool operator==(const cls& b) \
{ return cmp(b) == 0; } \
\
bool operator!=(const cls& b) \
{ return cmp(b) != 0; } \
\
bool operator<(const cls& b) \
{ return cmp(b) < 0; } \
\
bool operator<=(const cls& b) \
{ return cmp(b) <= 0; } \
\
bool operator>(const cls& b) \
{ return cmp(b) > 0; } \
\
bool operator>=(const cls& b) \
{ return cmp(b) >= 0; } ) \
bool operator<=(const ast_family &a, const ast_family &b)
Less-than-or-equal operator for ast_family.
Definition: cs_ast_decl.hpp:67
bool operator>=(const ast_family &a, const ast_family &b)
Greater-than-or-equal operator for ast_family.
Definition: cs_ast_decl.hpp:67
bool operator>(const ast_family &a, const ast_family &b)
Greater-than operator for ast_family.
Definition: cs_ast_decl.hpp:67
bool operator<(const ast_family &a, const ast_family &b)
Less-than operator for ast_family.
Definition: cs_ast_decl.hpp:67
bool operator!=(const ast_family &a, const ast_family &b)
Inequality operator for ast_family.
Definition: cs_ast_decl.hpp:67

◆ CS_IR_BOILERPLATE_FORWARD

#define CS_IR_BOILERPLATE_FORWARD (   cls,
  CTYPE,
  friends 
)
Value:
CS_NODEFCTOR_TYPE(cls) \
class cls; \
template<> \
class cglue<cls > \
{ \
public: \
typedef CTYPE ctype; \
typedef cls type; \
private: \
friend class cls; \
friend class scratchpad<cls >; \
cglue(); \
static bool is_null(const ctype &x) \
{ return !!CTYPE ## _is_null(x); } \
static int ccmp(const ctype &a, const ctype &b) \
{ return CTYPE ## _compare(a, b); } \
static cs_hash_t chash(const ctype &a) \
{ return CTYPE ## _hash(a); } \
friends \
CS_CXX_API_CGLUE_ACCESS_MODIFIER: \
static type wrap(const ctype &c); \
static ctype unwrap(const type &c); \
}

◆ CS_IR_BOILERPLATE_FRIENDS_PLUS_OSTREAM

#define CS_IR_BOILERPLATE_FRIENDS_PLUS_OSTREAM (   cls,
  cs 
)
Value:
CS_IR_BOILERPLATE_FRIENDS(cls) \
CS_IR_BOILERPLATE_NONMEMBERS(cls, cs)
Namespace for CodeSonar/CodeSurfer API.
Definition: cs_ast.hpp:33

◆ CS_IR_BOILERPLATE_NONMEMBERS

#define CS_IR_BOILERPLATE_NONMEMBERS (   cls,
  cs 
)
Value:
\ \ \ \ \
inline std::ostream &operator<<( std::ostream &out, const cls &a ) \
{ \
return out << CS_AS_REPR_PREFIX << #cls " " \
<< a.as_string() << CS_AS_REPR_SUFFIX; \
} \
CS_STD_HASH(cls, cs)
Namespace for CodeSonar/CodeSurfer API.
Definition: cs_ast.hpp:33
std::ostream & operator<<(std::ostream &out, const ast_family &a)
Print a representation of a ast_family object to the specified stream.
Definition: cs_ast_decl.hpp:67

◆ CS_IR_BOILERPLATE_TYPENAME

#define CS_IR_BOILERPLATE_TYPENAME (   cls)
Value:
friend class cglue<cls>; \
public: \ \
typedef typename cglue<cls>::ctype ctype; \ \
private: \
cls(); \
typename cglue<cls>::ctype inner; \
cls(ctype _inner): inner(_inner){} \
ctype unwrap() const \
{ return inner; } \
public: \
\ \ \ \ \ \ \ \ \
int cmp(const cls& other) const \
{ return cglue<cls>::ccmp(this->unwrap(), other.unwrap()); } \
\ \
CS_BOILERPLATE_HASH_TYPE hash() const \
{ return cglue<cls>::chash(this->unwrap()); } \
CS_CMP_COMPARATORS(cls)