Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
29a28efd
Commit
29a28efd
authored
14 years ago
by
ilor
Browse files
Options
Downloads
Patches
Plain Diff
simple strset impl.
parent
b367ef94
Branches
Branches containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
libwccl/CMakeLists.txt
+1
-0
1 addition, 0 deletions
libwccl/CMakeLists.txt
libwccl/values/strset.cpp
+25
-0
25 additions, 0 deletions
libwccl/values/strset.cpp
libwccl/values/strset.h
+64
-0
64 additions, 0 deletions
libwccl/values/strset.h
libwccl/variables.h
+4
-1
4 additions, 1 deletion
libwccl/variables.h
with
94 additions
and
1 deletion
libwccl/CMakeLists.txt
+
1
−
0
View file @
29a28efd
...
@@ -17,6 +17,7 @@ SET(libwccl_STAT_SRC
...
@@ -17,6 +17,7 @@ SET(libwccl_STAT_SRC
values/bool.cpp
values/bool.cpp
values/position.cpp
values/position.cpp
values/positionref.cpp
values/positionref.cpp
values/strset.cpp
values/value.cpp
values/value.cpp
variables.cpp
variables.cpp
)
)
...
...
This diff is collapsed.
Click to expand it.
libwccl/values/strset.cpp
0 → 100644
+
25
−
0
View file @
29a28efd
#include
<libwccl/values/strset.h>
#include
<libpwrutils/foreach.h>
#include
<libpwrutils/util.h>
#include
<sstream>
namespace
Wccl
{
const
char
*
StrSet
::
type_name
=
"StrSet"
;
std
::
string
StrSet
::
to_raw_string
()
const
{
std
::
stringstream
ss
;
ss
<<
"{"
;
bool
comma
=
false
;
foreach
(
const
UnicodeString
&
u
,
set_
)
{
if
(
comma
)
{
ss
<<
","
;
}
ss
<<
'\"'
<<
PwrNlp
::
to_utf8
(
u
)
<<
'\"'
;
//TODO escaping
}
return
ss
.
str
();
}
}
/* end ns Wccl */
This diff is collapsed.
Click to expand it.
libwccl/values/strset.h
0 → 100644
+
64
−
0
View file @
29a28efd
#ifndef LIBWCCL_VALUES_STRSET_H
#define LIBWCCL_VALUES_STRSET_H
#include
<libwccl/values/value.h>
#include
<boost/unordered_set.hpp>
#include
<libcorpus2/lexeme.h>
// for unicodestring hash
namespace
Wccl
{
class
StrSet
:
public
Value
{
public:
WCCL_VALUE_PREAMBLE
typedef
boost
::
unordered_set
<
UnicodeString
>
set_t
;
StrSet
()
:
set_
()
{
}
explicit
StrSet
(
const
set_t
&
s
)
:
set_
(
s
)
{
}
const
set_t
&
contents
()
const
{
return
set_
;
}
set_t
&
contents
()
{
return
set_
;
}
void
set_contents
(
const
set_t
&
set
)
{
set_
=
set
;
}
void
swap
(
StrSet
&
ss
)
{
ss
.
set_
.
swap
(
set_
);
}
void
insert
(
const
UnicodeString
&
u
)
{
set_
.
insert
(
u
);
}
void
insert_utf8
(
const
std
::
string
&
u
)
{
insert
(
UnicodeString
::
fromUTF8
(
u
));
}
int
size
()
const
{
return
set_
.
size
();
}
/// Value override
std
::
string
to_raw_string
()
const
;
private
:
set_t
set_
;
};
}
/* end ns Wccl */
#endif // LIBWCCL_VALUES_STRSET_H
This diff is collapsed.
Click to expand it.
libwccl/variables.h
+
4
−
1
View file @
29a28efd
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include
<libwccl/exception.h>
#include
<libwccl/exception.h>
#include
<libwccl/values/position.h>
#include
<libwccl/values/position.h>
#include
<libwccl/values/positionref.h>
#include
<libwccl/values/positionref.h>
#include
<libwccl/values/strset.h>
#include
<iostream>
#include
<iostream>
#include
<map>
#include
<map>
#include
<string>
#include
<string>
...
@@ -84,11 +85,13 @@ class Variables : detail::Vmap<Value>
...
@@ -84,11 +85,13 @@ class Variables : detail::Vmap<Value>
,
detail
::
Vmap
<
Bool
>
,
detail
::
Vmap
<
Bool
>
,
detail
::
Vmap
<
Position
>
,
detail
::
Vmap
<
Position
>
,
detail
::
Vmap
<
PositionRef
>
,
detail
::
Vmap
<
PositionRef
>
,
detail
::
Vmap
<
StrSet
>
{
{
public:
public:
/// Valid value types, should match the inheritance.
/// Valid value types, should match the inheritance.
/// the type Value must be first, order of other items is not important
/// the type Value must be first, order of other items is not important
typedef
boost
::
mpl
::
list
<
Value
,
Bool
,
Position
,
PositionRef
>
types
;
typedef
boost
::
mpl
::
list
<
Value
,
Bool
,
Position
,
PositionRef
,
StrSet
>
types
;
/// Constructor, creates an empty instance.
/// Constructor, creates an empty instance.
Variables
();
Variables
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment