CBMC
identifier.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module:
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
#include "
identifier.h
"
10
11
#include <cstring>
12
13
std::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
28
void
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
{
38
i+=strlen(
ID_SEPARATOR
);
39
break
;
40
}
41
else
42
component
+=s[i];
43
}
44
45
components
.push_back(
component
);
46
component
.clear();
47
}
48
}
identifiert::components
componentst components
Definition:
identifier.h:30
component
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
Definition:
std_expr.cpp:76
ID_SEPARATOR
#define ID_SEPARATOR
Definition:
identifier.h:16
identifiert::as_string
std::string as_string() const
Definition:
identifier.cpp:13
identifier.h
identifiert::parse
void parse(const std::string &s)
Definition:
identifier.cpp:28
src
util
identifier.cpp
Generated by
1.8.17