RTC: Refine the api for context.

pull/1882/head
winlin 5 years ago
parent 22ed55e2e5
commit a6b2e28d50

@ -37,17 +37,21 @@ _SrsContextId::_SrsContextId(const _SrsContextId& cp)
v_ = cp.v_; v_ = cp.v_;
} }
const char* _SrsContextId::c_str() _SrsContextId::~_SrsContextId()
{
}
const char* _SrsContextId::c_str() const
{ {
return v_.c_str(); return v_.c_str();
} }
bool _SrsContextId::empty() bool _SrsContextId::empty() const
{ {
return v_.empty(); return v_.empty();
} }
int _SrsContextId::compare(const _SrsContextId& to) int _SrsContextId::compare(const _SrsContextId& to) const
{ {
return v_.compare(to.v_); return v_.compare(to.v_);
} }

@ -125,14 +125,15 @@ public:
_SrsContextId(); _SrsContextId();
_SrsContextId(std::string v); _SrsContextId(std::string v);
_SrsContextId(const _SrsContextId& cp); _SrsContextId(const _SrsContextId& cp);
virtual ~_SrsContextId();
public: public:
const char* c_str(); const char* c_str() const;
bool empty(); bool empty() const;
// Compare the two context id. @see http://www.cplusplus.com/reference/string/string/compare/ // Compare the two context id. @see http://www.cplusplus.com/reference/string/string/compare/
// 0 They compare equal // 0 They compare equal
// <0 Either the value of the first character that does not match is lower in the compared string, or all compared characters match but the compared string is shorter. // <0 Either the value of the first character that does not match is lower in the compared string, or all compared characters match but the compared string is shorter.
// >0 Either the value of the first character that does not match is greater in the compared string, or all compared characters match but the compared string is longer. // >0 Either the value of the first character that does not match is greater in the compared string, or all compared characters match but the compared string is longer.
int compare(const _SrsContextId& to); int compare(const _SrsContextId& to) const;
}; };
typedef _SrsContextId SrsContextId; typedef _SrsContextId SrsContextId;
#else #else

Loading…
Cancel
Save