Commit 742206f2 authored by Daniel Elstner's avatar Daniel Elstner
Browse files

Replace occurrences of "lhs" and "rhs" with "a" and "b", respectively.

* src/fileshared.h: Replace occurrences of "lhs" and "rhs" with
"a" and "b", respectively.
(BoundState): Remove BOUND_MASK value from enumeration as it is
nowhere being used.

svn path=/trunk/; revision=635
parent 4fa17b0f
2007-01-14 Daniel Elstner <daniel.kitta@gmail.com>
* src/fileshared.h: Replace occurrences of "lhs" and "rhs" with
"a" and "b", respectively.
(BoundState): Remove BOUND_MASK value from enumeration as it is
nowhere being used.
2007-01-14 Daniel Elstner <daniel.kitta@gmail.com>
* src/filetree.{cc,h}: Clean up the code a bit. In particular,
......
......@@ -28,7 +28,6 @@
#include <utility>
#include <vector>
namespace Pcre { class Pattern; }
namespace Regexxer
......@@ -38,40 +37,39 @@ enum BoundState
{
BOUND_NONE = 0,
BOUND_FIRST = 1 << 0,
BOUND_LAST = 1 << 1,
BOUND_MASK = BOUND_FIRST | BOUND_LAST
BOUND_LAST = 1 << 1
};
inline BoundState operator|(BoundState lhs, BoundState rhs)
{ return static_cast<BoundState>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
inline BoundState operator|(BoundState a, BoundState b)
{ return static_cast<BoundState>(static_cast<unsigned>(a) | static_cast<unsigned>(b)); }
inline BoundState operator&(BoundState lhs, BoundState rhs)
{ return static_cast<BoundState>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
inline BoundState operator&(BoundState a, BoundState b)
{ return static_cast<BoundState>(static_cast<unsigned>(a) & static_cast<unsigned>(b)); }
inline BoundState operator^(BoundState lhs, BoundState rhs)
{ return static_cast<BoundState>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
inline BoundState operator^(BoundState a, BoundState b)
{ return static_cast<BoundState>(static_cast<unsigned>(a) ^ static_cast<unsigned>(b)); }
inline BoundState operator~(BoundState flags)
{ return static_cast<BoundState>(~static_cast<unsigned>(flags)); }
inline BoundState& operator|=(BoundState& lhs, BoundState rhs)
{ return (lhs = static_cast<BoundState>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
inline BoundState& operator&=(BoundState& lhs, BoundState rhs)
{ return (lhs = static_cast<BoundState>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
inline BoundState& operator|=(BoundState& a, BoundState b)
{ return (a = static_cast<BoundState>(static_cast<unsigned>(a) | static_cast<unsigned>(b))); }
inline BoundState& operator^=(BoundState& lhs, BoundState rhs)
{ return (lhs = static_cast<BoundState>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
inline BoundState& operator&=(BoundState& a, BoundState b)
{ return (a = static_cast<BoundState>(static_cast<unsigned>(a) & static_cast<unsigned>(b))); }
inline BoundState& operator^=(BoundState& a, BoundState b)
{ return (a = static_cast<BoundState>(static_cast<unsigned>(a) ^ static_cast<unsigned>(b))); }
// This struct holds all the information that's necessary to locate a
// match's position in the buffer and to substitute captured substrings
// into a replacement string. The latter is achived by storing the whole
// subject string (i.e. the line in the buffer) together with a table of
// indices into it. This arrangement should consume less memory than the
// alternative of storing a vector of captured substrings since we want
// to support $&, $`, $' too.
//
/*
* This struct holds all the information that's necessary to locate a
* match's position in the buffer and to substitute captured substrings
* into a replacement string. The latter is achieved by storing the whole
* subject string (i.e. the line in the buffer) together with a table of
* indices into it. This arrangement should consume less memory than the
* alternative of storing a vector of captured substrings since we want
* to support $&, $`, $' too.
*/
struct MatchData : public Util::SharedObject
{
int index;
......@@ -96,12 +94,13 @@ private:
typedef Util::SharedPtr<MatchData> MatchDataPtr;
/* Sort predicate for use with std::set<>.
/*
* Sort predicate for use with std::set<>.
*/
struct MatchDataLess : public std::binary_function<MatchDataPtr, MatchDataPtr, bool>
{
bool operator()(const MatchDataPtr& lhs, const MatchDataPtr& rhs) const
{ return (lhs->index < rhs->index); }
bool operator()(const MatchDataPtr& a, const MatchDataPtr& b) const
{ return (a->index < b->index); }
};
} // namespace Regexxer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment