Move trivial parts of UserID into the header.

llvm-svn: 106535
This commit is contained in:
Benjamin Kramer
2010-06-22 10:44:12 +00:00
parent 69da4a8f07
commit 104819c6eb
2 changed files with 16 additions and 56 deletions

View File

@@ -35,7 +35,7 @@ struct UserID
//------------------------------------------------------------------
/// Construct with optional user ID.
//------------------------------------------------------------------
UserID (lldb::user_id_t uid = LLDB_INVALID_UID);
UserID (lldb::user_id_t uid = LLDB_INVALID_UID) : m_uid(uid) {}
//------------------------------------------------------------------
/// Destructor.
@@ -51,7 +51,7 @@ struct UserID
/// Clears the object contents back to a default invalid state.
//------------------------------------------------------------------
void
Clear ();
Clear () { m_uid = LLDB_INVALID_UID; }
//------------------------------------------------------------------
/// Get accessor for the user ID.
@@ -60,7 +60,7 @@ struct UserID
/// The user ID.
//------------------------------------------------------------------
lldb::user_id_t
GetID () const;
GetID () const { return m_uid; }
//------------------------------------------------------------------
/// Set accessor for the user ID.
@@ -69,7 +69,7 @@ struct UserID
/// The new user ID.
//------------------------------------------------------------------
void
SetID (lldb::user_id_t uid);
SetID (lldb::user_id_t uid) { m_uid = uid; }
//------------------------------------------------------------------
/// Unary predicate function object that can search for a matching
@@ -88,13 +88,13 @@ struct UserID
//--------------------------------------------------------------
/// Construct with the user ID to look for.
//--------------------------------------------------------------
IDMatches (lldb::user_id_t uid);
IDMatches (lldb::user_id_t uid) : m_uid(uid) {}
//--------------------------------------------------------------
/// Unary predicate function object callback.
//--------------------------------------------------------------
bool
operator () (const UserID& rhs) const;
operator () (const UserID& rhs) const { return m_uid == rhs.GetID(); }
private:
//--------------------------------------------------------------
@@ -114,8 +114,16 @@ protected:
//--------------------------------------------------------------
/// Stream the UserID object to a Stream.
//--------------------------------------------------------------
bool operator== (const UserID& lhs, const UserID& rhs);
bool operator!= (const UserID& lhs, const UserID& rhs);
inline bool operator== (const UserID& lhs, const UserID& rhs)
{
return lhs.GetID() == rhs.GetID();
}
inline bool operator!= (const UserID& lhs, const UserID& rhs)
{
return lhs.GetID() != rhs.GetID();
}
Stream& operator << (Stream& strm, const UserID& uid);
} // namespace lldb_private

View File

@@ -13,61 +13,13 @@
using namespace lldb;
using namespace lldb_private;
UserID::UserID (user_id_t uid) :
m_uid(uid)
{
}
UserID::~UserID ()
{
}
void
UserID::Clear ()
{
m_uid = LLDB_INVALID_UID;
}
user_id_t
UserID::GetID () const
{
return m_uid;
}
void
UserID::SetID (user_id_t uid)
{
m_uid = uid;
}
UserID::IDMatches::IDMatches (user_id_t uid) :
m_uid(uid)
{
}
bool
UserID::IDMatches::operator() (const UserID& rhs) const
{
return m_uid == rhs.GetID();
}
Stream&
lldb_private::operator << (Stream& strm, const UserID& uid)
{
strm.Printf("{0x%8.8x}", uid.GetID());
return strm;
}
bool
lldb_private::operator== (const UserID& lhs, const UserID& rhs)
{
return lhs.GetID() == rhs.GetID();
}
bool
lldb_private::operator!= (const UserID& lhs, const UserID& rhs)
{
return lhs.GetID() != rhs.GetID();
}