Merge remote-tracking branch 'haiku/master' into package-management

Conflicts:
	build/jam/HaikuImage
	build/jam/OptionalPackageDependencies
	build/jam/OptionalPackages
	build/scripts/build_cross_tools_gcc4
	src/add-ons/translators/icns/Jamfile
	src/add-ons/translators/jpeg/Jamfile
This commit is contained in:
Ingo Weinhold
2013-07-08 14:01:00 +02:00
438 changed files with 15612 additions and 25171 deletions
+80
View File
@@ -0,0 +1,80 @@
/*
* Copyright 2013, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef REG_EXP_H
#define REG_EXP_H
#include <stddef.h>
class RegExp {
public:
enum PatternType {
PATTERN_TYPE_REGULAR_EXPRESSION,
PATTERN_TYPE_WILDCARD
};
class MatchResult;
public:
RegExp();
RegExp(const char* pattern,
PatternType patternType
= PATTERN_TYPE_REGULAR_EXPRESSION,
bool caseSensitive = true);
RegExp(const RegExp& other);
~RegExp();
bool IsValid() const
{ return fData != NULL; }
bool SetPattern(const char* pattern,
PatternType patternType
= PATTERN_TYPE_REGULAR_EXPRESSION,
bool caseSensitive = true);
MatchResult Match(const char* string) const;
RegExp& operator=(const RegExp& other);
private:
struct Data;
struct MatchResultData;
private:
Data* fData;
};
class RegExp::MatchResult {
public:
MatchResult();
MatchResult(const MatchResult& other);
~MatchResult();
bool HasMatched() const;
size_t StartOffset() const;
size_t EndOffset() const;
size_t GroupCount() const;
size_t GroupStartOffsetAt(size_t index) const;
size_t GroupEndOffsetAt(size_t index) const;
MatchResult& operator=(const MatchResult& other);
private:
friend class RegExp;
private:
MatchResult(MatchResultData* data);
// takes over the data reference
private:
MatchResultData* fData;
};
#endif // REG_EXP_H