Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Hello
GitLab will be updated tonight at 22:00. Expect short outage.
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
a75ea75a
Commit
a75ea75a
authored
5 years ago
by
Jan Trávníček
Browse files
Options
Downloads
Patches
Plain Diff
unit build in algo string properties
parent
9f553114
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
alib2algo/src/string/properties/StartsWith.cpp
+15
-0
15 additions, 0 deletions
alib2algo/src/string/properties/StartsWith.cpp
alib2algo/src/string/properties/StartsWith.h
+42
-0
42 additions, 0 deletions
alib2algo/src/string/properties/StartsWith.h
with
57 additions
and
0 deletions
alib2algo/src/string/properties/StartsWith.cpp
0 → 100644
+
15
−
0
View file @
a75ea75a
/*
*
StartsWith
.
cpp
*
*
Created
on
:
5.
11.
2014
*
Author
:
Jan
Travnicek
*/
#include
"StartsWith.h"
#include
<registration/AlgoRegistration.hpp>
namespace
{
auto
StartsWithLinearString
=
registration
::
AbstractRegister
<
string
::
properties
::
StartsWith
,
bool
,
const
string
::
LinearString
<
>
&
,
const
string
::
LinearString
<
>
&
>
(
string
::
properties
::
StartsWith
::
startsWith
);
}
/* namespace */
This diff is collapsed.
Click to expand it.
alib2algo/src/string/properties/StartsWith.h
0 → 100644
+
42
−
0
View file @
a75ea75a
/*
* StartsWith.h
*
* Created on: 5. 11. 2014
* Author: Jan Travnicek
*/
#ifndef _STRING_STARTS_WITH_H_
#define _STRING_STARTS_WITH_H_
#include <alib/set>
#include <alib/map>
#include <string/LinearString.h>
namespace string {
namespace properties {
class StartsWith {
public:
template < class SymbolType >
static bool startsWith ( const string::LinearString < SymbolType > & string, const string::LinearString < SymbolType > & prefix );
};
template < class SymbolType >
bool StartsWith::startsWith ( const string::LinearString < SymbolType > & string, const string::LinearString < SymbolType > & prefix ) {
for ( auto prefixIterator = prefix.getContent ( ).begin ( ), stringIterator = string.getContent ( ).begin ( ); prefixIterator != prefix.getContent ( ).end ( ); ++ prefixIterator, ++ stringIterator ) {
if ( stringIterator == string.getContent ( ).end ( ) )
return false;
if ( * prefixIterator != * stringIterator )
return false;
}
return true;
}
} /* namespace properties */
} /* namespace string */
#endif /* _STRING_STARTS_WITH_H_ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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