FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
poco/CppParser/src/Variable.cpp at develop · cppfool/poco · GitHub
cppfool
/
poco
Public
forked from
pocoproject/poco
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
poco
/
CppParser
/
src
/
Variable.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
78 lines (61 loc) · 1.63 KB
Breadcrumbs
poco
/
CppParser
/
src
/
Variable.cpp
Copy path
File metadata and controls
78 lines (61 loc) · 1.63 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//
//
Variable.cpp
//
//
$Id: //poco/1.4/CppParser/src/Variable.cpp#1 $
//
//
Library: CppParser
//
Package: SymbolTable
//
Module: Variable
//
//
Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
//
and Contributors.
//
//
SPDX-License-Identifier: BSL-1.0
//
#
include
"
Poco/CppParser/Variable.h
"
#
include
"
Poco/String.h
"
#
include
<
cstddef
>
namespace
Poco
{
namespace
CppParser
{
Variable::Variable
(
const
std::string& decl, NameSpace* pNameSpace):
Decl
(decl, pNameSpace),
_flags
(
0
),
_isPointer
(
false
),
_type
()
{
if
(
hasAttr
(decl,
"
static
"
))
_flags |=
VAR_STATIC
;
if
(
hasAttr
(decl,
"
mutable
"
))
_flags |=
VAR_MUTABLE
;
if
(
hasAttr
(decl,
"
volatile
"
))
_flags |=
VAR_VOLATILE
;
if
(
hasAttr
(decl,
"
const
"
))
_flags |=
VAR_CONST
;
std::
size_t
pos = decl.
rfind
(
name
());
std::string tmp = decl.
substr
(
0
, pos);
tmp =
Poco::trim
(tmp);
pos = tmp.
rfind
(
"
*
"
);
_isPointer = (pos == (tmp.
size
()-
1
));
Poco::replaceInPlace
(tmp,
"
static
"
,
"
"
);
Poco::replaceInPlace
(tmp,
"
mutable
"
,
"
"
);
Poco::replaceInPlace
(tmp,
"
volatile
"
,
"
"
);
Poco::replaceInPlace
(tmp,
"
static
\t
"
,
"
"
);
Poco::replaceInPlace
(tmp,
"
mutable
\t
"
,
"
"
);
Poco::replaceInPlace
(tmp,
"
volatile
\t
"
,
"
"
);
if
(tmp.
find
(
"
const
"
) ==
0
)
tmp = tmp.
substr
(
6
);
if
(tmp.
find
(
"
const
\t
"
) ==
0
)
tmp = tmp.
substr
(
6
);
std::
size_t
rightCut = tmp.
size
();
while
(rightCut >
0
&& (tmp[rightCut-
1
] ==
'
&
'
|| tmp[rightCut-
1
] ==
'
*
'
|| tmp[rightCut-
1
] ==
'
\t
'
|| tmp[rightCut-
1
] ==
'
'
))
--rightCut;
_type =
Poco::trim
(tmp.
substr
(
0
, rightCut));
}
Variable::~Variable
()
{
}
Symbol::Kind
Variable::kind
()
const
{
return
Symbol::
SYM_VARIABLE
;
}
} }
//
namespace Poco::CppParser
Back
|
FazBrowse Home
|
New Git URL