Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
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
corpus2
Commits
857b81fb
Commit
857b81fb
authored
14 years ago
by
ilor
Browse files
Options
Downloads
Patches
Plain Diff
add require_matching_tagsets convenience function
parent
6ec02023
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcorpus2/tagset.h
+48
-0
48 additions, 0 deletions
libcorpus2/tagset.h
with
48 additions
and
0 deletions
libcorpus2/tagset.h
+
48
−
0
View file @
857b81fb
...
...
@@ -59,6 +59,22 @@ public:
tagset_idx_t
expected_id
,
actual_id
;
};
/**
* Convenience function to check if tagsets match and throw if not, with the
* given "where" circumstance string
*/
void
require_matching_tagsets
(
const
Tagset
&
expected
,
const
Tagset
&
actual
,
const
std
::
string
&
where
);
/**
* Convenience function that calls the non-template require_matching_tagsets
* but can be called with something that has a tagset() method or a tagset
* object.
*/
template
<
class
T
>
void
require_matching_tagsets
(
const
T
&
expected
,
const
T
&
actual
,
const
std
::
string
&
where
);
class
TagsetParser
;
class
Token
;
...
...
@@ -373,6 +389,38 @@ private:
std
::
vector
<
std
::
vector
<
bool
>
>
pos_required_attributes_
;
};
/* implementation */
template
<
class
T
,
class
U
>
inline
void
require_matching_tagsets
(
const
T
&
expected
,
const
U
&
actual
,
const
std
::
string
&
where
)
{
require_matching_tagsets
(
expected
.
tagset
(),
actual
.
tagset
(),
where
);
}
template
<
class
T
>
inline
void
require_matching_tagsets
(
const
T
&
expected
,
const
Tagset
&
actual
,
const
std
::
string
&
where
)
{
require_matching_tagsets
(
expected
.
tagset
(),
actual
,
where
);
}
template
<
class
T
>
inline
void
require_matching_tagsets
(
const
Tagset
&
expected
,
const
T
&
actual
,
const
std
::
string
&
where
)
{
require_matching_tagsets
(
expected
,
actual
.
tagset
(),
where
);
}
inline
void
require_matching_tagsets
(
const
Tagset
&
expected
,
const
Tagset
&
actual
,
const
std
::
string
&
where
)
{
if
(
actual
.
id
()
!=
expected
.
id
())
{
throw
TagsetMismatch
(
where
,
expected
,
actual
);
}
}
}
/* end ns Corpus2 */
#endif // LIBCORPUS2_TAGSET_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