diff options
Diffstat (limited to 'include/lldb/Core/UserID.h')
-rw-r--r-- | include/lldb/Core/UserID.h | 154 |
1 files changed, 71 insertions, 83 deletions
diff --git a/include/lldb/Core/UserID.h b/include/lldb/Core/UserID.h index 230e43fa551f..596448334555 100644 --- a/include/lldb/Core/UserID.h +++ b/include/lldb/Core/UserID.h @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// - #ifndef liblldb_UserID_h_ #define liblldb_UserID_h_ @@ -30,101 +29,90 @@ namespace lldb_private { /// index, functions can use it to store the symbol table index or the /// DWARF offset. //---------------------------------------------------------------------- -struct UserID -{ - //------------------------------------------------------------------ - /// Construct with optional user ID. - //------------------------------------------------------------------ - UserID (lldb::user_id_t uid = LLDB_INVALID_UID) : m_uid(uid) {} - - //------------------------------------------------------------------ - /// Destructor. - //------------------------------------------------------------------ - ~UserID () - { - } - - //------------------------------------------------------------------ - /// Clears the object state. - /// - /// Clears the object contents back to a default invalid state. - //------------------------------------------------------------------ - void - Clear () { m_uid = LLDB_INVALID_UID; } - - //------------------------------------------------------------------ - /// Get accessor for the user ID. - /// - /// @return - /// The user ID. - //------------------------------------------------------------------ - lldb::user_id_t - GetID () const { return m_uid; } - - //------------------------------------------------------------------ - /// Set accessor for the user ID. - /// - /// @param[in] uid - /// The new user ID. - //------------------------------------------------------------------ - void - SetID (lldb::user_id_t uid) { m_uid = uid; } - - //------------------------------------------------------------------ - /// Unary predicate function object that can search for a matching - /// user ID. - /// - /// Function object that can be used on any class that inherits - /// from UserID: - /// \code - /// iterator pos; - /// pos = std::find_if (coll.begin(), coll.end(), UserID::IDMatches(blockID)); - /// \endcode - //------------------------------------------------------------------ - class IDMatches - { - public: - //-------------------------------------------------------------- - /// Construct with the user ID to look for. - //-------------------------------------------------------------- - IDMatches (lldb::user_id_t uid) : m_uid(uid) {} - - //-------------------------------------------------------------- - /// Unary predicate function object callback. - //-------------------------------------------------------------- - bool - operator () (const UserID& rhs) const { return m_uid == rhs.GetID(); } - - private: - //-------------------------------------------------------------- - // Member variables. - //-------------------------------------------------------------- - const lldb::user_id_t m_uid; ///< The user ID we are looking for - }; - +struct UserID { + //------------------------------------------------------------------ + /// Construct with optional user ID. + //------------------------------------------------------------------ + UserID(lldb::user_id_t uid = LLDB_INVALID_UID) : m_uid(uid) {} + + //------------------------------------------------------------------ + /// Destructor. + //------------------------------------------------------------------ + ~UserID() {} + + //------------------------------------------------------------------ + /// Clears the object state. + /// + /// Clears the object contents back to a default invalid state. + //------------------------------------------------------------------ + void Clear() { m_uid = LLDB_INVALID_UID; } + + //------------------------------------------------------------------ + /// Get accessor for the user ID. + /// + /// @return + /// The user ID. + //------------------------------------------------------------------ + lldb::user_id_t GetID() const { return m_uid; } + + //------------------------------------------------------------------ + /// Set accessor for the user ID. + /// + /// @param[in] uid + /// The new user ID. + //------------------------------------------------------------------ + void SetID(lldb::user_id_t uid) { m_uid = uid; } + + //------------------------------------------------------------------ + /// Unary predicate function object that can search for a matching + /// user ID. + /// + /// Function object that can be used on any class that inherits + /// from UserID: + /// \code + /// iterator pos; + /// pos = std::find_if (coll.begin(), coll.end(), UserID::IDMatches(blockID)); + /// \endcode + //------------------------------------------------------------------ + class IDMatches { + public: + //-------------------------------------------------------------- + /// Construct with the user ID to look for. + //-------------------------------------------------------------- + IDMatches(lldb::user_id_t uid) : m_uid(uid) {} + + //-------------------------------------------------------------- + /// Unary predicate function object callback. + //-------------------------------------------------------------- + bool operator()(const UserID &rhs) const { return m_uid == rhs.GetID(); } + + private: + //-------------------------------------------------------------- + // Member variables. + //-------------------------------------------------------------- + const lldb::user_id_t m_uid; ///< The user ID we are looking for + }; protected: - //------------------------------------------------------------------ - // Member variables. - //------------------------------------------------------------------ - lldb::user_id_t m_uid; ///< The user ID that uniquely identifies an object. + //------------------------------------------------------------------ + // Member variables. + //------------------------------------------------------------------ + lldb::user_id_t m_uid; ///< The user ID that uniquely identifies an object. }; -inline 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) -{ +inline bool operator!=(const UserID &lhs, const UserID &rhs) { return lhs.GetID() != rhs.GetID(); } //-------------------------------------------------------------- /// Stream the UserID object to a Stream. //-------------------------------------------------------------- -Stream& operator << (Stream& strm, const UserID& uid); +Stream &operator<<(Stream &strm, const UserID &uid); } // namespace lldb_private -#endif // liblldb_UserID_h_ +#endif // liblldb_UserID_h_ |