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
09859b9c
Commit
09859b9c
authored
14 years ago
by
ilor
Browse files
Options
Downloads
Patches
Plain Diff
add SentenceContext clone and duplicate
parent
83bbfa4d
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libwccl/sentencecontext.cpp
+12
-0
12 additions, 0 deletions
libwccl/sentencecontext.cpp
libwccl/sentencecontext.h
+10
-1
10 additions, 1 deletion
libwccl/sentencecontext.h
with
22 additions
and
1 deletion
libwccl/sentencecontext.cpp
+
12
−
0
View file @
09859b9c
...
...
@@ -7,4 +7,16 @@ SentenceContext::SentenceContext(const boost::shared_ptr<Corpus2::Sentence>& s)
{
}
SentenceContext
SentenceContext
::
duplicate
()
const
{
SentenceContext
dup
(
*
this
);
dup
.
sentence_
.
reset
(
sentence_
->
clone
());
return
dup
;
}
SentenceContext
*
SentenceContext
::
clone
()
const
{
return
new
SentenceContext
(
duplicate
());
}
}
/* end ns Wccl */
This diff is collapsed.
Click to expand it.
libwccl/sentencecontext.h
+
10
−
1
View file @
09859b9c
...
...
@@ -9,13 +9,20 @@ namespace Wccl {
/**
* A wrapper for a Corpus2 Sentence that adds a "current position"
* and several convenience functions.
*
* Copying contexts is cheap and safe since the sentence is kept through
* a shared pointer, use duplicate() or clone() to get a copy with a separate
* underlying sentence (which is slower).
*/
class
SentenceContext
{
public:
/// Constructor, wraps the Sentence and s
t
es position to 0
/// Constructor, wraps the Sentence and se
t
s position to 0
SentenceContext
(
const
boost
::
shared_ptr
<
Corpus2
::
Sentence
>&
s
);
/// Returns a copy of this with a cloned underlyiong sentence
SentenceContext
duplicate
()
const
;
/// Cloning -- clones the underlying sentence as well
SentenceContext
*
clone
()
const
;
...
...
@@ -97,6 +104,8 @@ private:
int
position_
;
};
// TODO ConstSentenceContext ?
}
/* end ns Wccl */
#endif // LIBWCCL_SENTENCECONTEXT_H
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