cprover
string_constant.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 #ifndef CPROVER_UTIL_STRING_CONSTANT_H
10 #define CPROVER_UTIL_STRING_CONSTANT_H
11 
12 #include "std_expr.h"
13 #include "expr.h"
14 
15 class string_constantt:public exprt
16 {
17 public:
19  explicit string_constantt(const irep_idt &value);
20 
21  void set_value(const irep_idt &value);
22 
23  const irep_idt &get_value() const
24  {
25  return get(ID_value);
26  }
27 
28  array_exprt to_array_expr() const;
29  bool from_array_expr(const array_exprt &);
30 };
31 
32 inline const string_constantt &to_string_constant(const exprt &expr)
33 {
34  assert(expr.id()==ID_string_constant);
35  return static_cast<const string_constantt &>(expr);
36 }
37 
39 {
40  assert(expr.id()==ID_string_constant);
41  return static_cast<string_constantt &>(expr);
42 }
43 
44 #endif // CPROVER_ANSI_C_STRING_CONSTANT_H
void set_value(const irep_idt &value)
bool from_array_expr(const array_exprt &)
convert array constant into string
const irep_idt & id() const
Definition: irep.h:189
API to expression classes.
array_exprt to_array_expr() const
convert string into array constant
const string_constantt & to_string_constant(const exprt &expr)
Base class for all expressions.
Definition: expr.h:42
const irep_idt & get_value() const
array constructor from list of elements
Definition: std_expr.h:1617