mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
CharReach operators inline
This commit is contained in:
parent
ff721ed8e4
commit
938ac9fd38
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Intel Corporation
|
* Copyright (c) 2015-2016, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -50,44 +50,6 @@ void CharReach::set(const std::string &s) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Bitwise OR.
|
|
||||||
CharReach CharReach::operator|(const CharReach &a) const {
|
|
||||||
CharReach cr(*this);
|
|
||||||
cr.bits |= a.bits;
|
|
||||||
return cr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Bitwise OR-equals.
|
|
||||||
void CharReach::operator|=(const CharReach &a) {
|
|
||||||
bits |= a.bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Bitwise AND.
|
|
||||||
CharReach CharReach::operator&(const CharReach &a) const {
|
|
||||||
CharReach cr(*this);
|
|
||||||
cr.bits &= a.bits;
|
|
||||||
return cr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Bitwise AND-equals.
|
|
||||||
void CharReach::operator&=(const CharReach &a) {
|
|
||||||
bits &= a.bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Bitwise complement.
|
|
||||||
CharReach CharReach::operator~(void) const {
|
|
||||||
CharReach cr(*this);
|
|
||||||
cr.flip();
|
|
||||||
return cr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Bitwise XOR.
|
|
||||||
CharReach CharReach::operator^(const CharReach &a) const {
|
|
||||||
CharReach cr(*this);
|
|
||||||
cr.bits ^= a.bits;
|
|
||||||
return cr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Do we only contain bits representing alpha characters?
|
/// Do we only contain bits representing alpha characters?
|
||||||
bool CharReach::isAlpha() const {
|
bool CharReach::isAlpha() const {
|
||||||
if (none()) {
|
if (none()) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Intel Corporation
|
* Copyright (c) 2015-2016, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -135,22 +135,38 @@ public:
|
|||||||
size_t find_nth(size_t n) const { return bits.find_nth(n); }
|
size_t find_nth(size_t n) const { return bits.find_nth(n); }
|
||||||
|
|
||||||
/// Bitwise OR.
|
/// Bitwise OR.
|
||||||
CharReach operator|(const CharReach &a) const;
|
CharReach operator|(const CharReach &a) const {
|
||||||
|
CharReach cr(*this);
|
||||||
|
cr.bits |= a.bits;
|
||||||
|
return cr;
|
||||||
|
}
|
||||||
|
|
||||||
/// Bitwise OR-equals.
|
/// Bitwise OR-equals.
|
||||||
void operator|=(const CharReach &a);
|
void operator|=(const CharReach &a) { bits |= a.bits; }
|
||||||
|
|
||||||
/// Bitwise AND.
|
/// Bitwise AND.
|
||||||
CharReach operator&(const CharReach &a) const;
|
CharReach operator&(const CharReach &a) const {
|
||||||
|
CharReach cr(*this);
|
||||||
|
cr.bits &= a.bits;
|
||||||
|
return cr;
|
||||||
|
}
|
||||||
|
|
||||||
/// Bitwise AND-equals.
|
/// Bitwise AND-equals.
|
||||||
void operator&=(const CharReach &a);
|
void operator&=(const CharReach &a) { bits &= a.bits; }
|
||||||
|
|
||||||
/// Bitwise XOR.
|
/// Bitwise XOR.
|
||||||
CharReach operator^(const CharReach &a) const;
|
CharReach operator^(const CharReach &a) const {
|
||||||
|
CharReach cr(*this);
|
||||||
|
cr.bits ^= a.bits;
|
||||||
|
return cr;
|
||||||
|
}
|
||||||
|
|
||||||
/// Bitwise complement.
|
/// Bitwise complement.
|
||||||
CharReach operator~(void) const;
|
CharReach operator~(void) const {
|
||||||
|
CharReach cr(*this);
|
||||||
|
cr.flip();
|
||||||
|
return cr;
|
||||||
|
}
|
||||||
|
|
||||||
/// Do we only contain bits representing alpha characters?
|
/// Do we only contain bits representing alpha characters?
|
||||||
bool isAlpha() const;
|
bool isAlpha() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user