1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00

RTC: Refine the api for context.

This commit is contained in:
winlin 2020-07-10 18:06:07 +08:00
parent 22ed55e2e5
commit a6b2e28d50
2 changed files with 11 additions and 6 deletions

View file

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

View file

@ -125,14 +125,15 @@ public:
_SrsContextId();
_SrsContextId(std::string v);
_SrsContextId(const _SrsContextId& cp);
virtual ~_SrsContextId();
public:
const char* c_str();
bool empty();
const char* c_str() const;
bool empty() const;
// Compare the two context id. @see http://www.cplusplus.com/reference/string/string/compare/
// 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 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;
#else