CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
identifier.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9#include "identifier.h"
10
11#include <cstring>
12
13std::string identifiert::as_string() const
14{
15 std::string result;
16
17 for(componentst::const_iterator it=components.begin();
18 it!=components.end(); it++)
19 {
20 if(it!=components.begin())
21 result+=ID_SEPARATOR;
22 result+=*it;
23 }
24
25 return result;
26}
27
28void identifiert::parse(const std::string &s)
29{
30 std::string component;
31
32 for(size_t i=0; i<s.size();)
33 {
34 for(; i<s.size(); i++)
35 {
36 if(strncmp(s.c_str()+i, ID_SEPARATOR, strlen(ID_SEPARATOR))==0)
37 {
39 break;
40 }
41 else
42 component+=s[i];
43 }
44
45 components.push_back(component);
47 }
48}
virtual void clear()
Reset the abstract state.
Definition ai.h:265
void parse(const std::string &s)
std::string as_string() const
componentst components
Definition identifier.h:30
#define ID_SEPARATOR
Definition identifier.h:16
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
Definition std_expr.cpp:97
int strncmp(const char *s1, const char *s2, size_t n)
Definition string.c:464
size_t strlen(const char *s)
Definition string.c:561