mirror of
https://github.com/znc/znc.git
synced 2026-08-06 00:43:19 +02:00
Fix tabs/spaces inside comments
This commit is contained in:
+53
-53
@@ -192,61 +192,61 @@ class CClient : public CIRCSocket {
|
||||
|
||||
void PutIRC(const CString& sLine);
|
||||
/** Sends a raw data line to the client.
|
||||
* @param sLine The line to be sent.
|
||||
*
|
||||
* The line is first passed \e unmodified to the \ref CModule::OnSendToClient()
|
||||
* module hook. If no module halts the process, the line is then sent to the client.
|
||||
*
|
||||
* These lines appear in the debug output in the following syntax:
|
||||
* \code [time] (user/network) ZNC -> CLI [line] \endcode
|
||||
*/
|
||||
* @param sLine The line to be sent.
|
||||
*
|
||||
* The line is first passed \e unmodified to the \ref CModule::OnSendToClient()
|
||||
* module hook. If no module halts the process, the line is then sent to the client.
|
||||
*
|
||||
* These lines appear in the debug output in the following syntax:
|
||||
* \code [time] (user/network) ZNC -> CLI [line] \endcode
|
||||
*/
|
||||
void PutClient(const CString& sLine);
|
||||
/** Sends a message to the client.
|
||||
* @param Message The message to be sent.
|
||||
* @note Only known and compatible messages and tags are sent.
|
||||
* @return \c true if the message was sent, or \c false if it was ignored.
|
||||
*
|
||||
* This method ensures that only messages and tags, that the client has
|
||||
* explicitly requested, are sent. Not all IRC clients are capable of
|
||||
* handling all messages and tags. For example, some older versions of
|
||||
* popular clients were prepared to parse just one interesting tag,
|
||||
* \c time, and would break if multiple tags were included. Furthermore,
|
||||
* messages that are specific to a certain capability, should not be sent
|
||||
* to a client that has not requested the respective capability. Thus, in
|
||||
* order to stay compatible with a variety of IRC clients, ZNC has to
|
||||
* filter out messages and tags that the client has not explicitly
|
||||
* requested.
|
||||
*
|
||||
* ### Message types
|
||||
*
|
||||
* The following table documents which capabilities the client is required
|
||||
* to have requested in order to receive certain types of messages.
|
||||
*
|
||||
* Message type | Capability
|
||||
* ------------ | ----------
|
||||
* \c ACCOUNT | \l CClient::HasAccountNotify() (<a href="http://ircv3.net/specs/extensions/account-notify-3.1.html">account-notify</a>)
|
||||
* \c AWAY | \l CClient::HasAwayNotify() (<a href="http://ircv3.net/specs/extensions/away-notify-3.1.html">away-notify</a>)
|
||||
*
|
||||
* ### Message tags
|
||||
*
|
||||
* The following table documents currently supported message tags, and
|
||||
* which capabilities the client is required to have requested to receive
|
||||
* the respective message tags.
|
||||
*
|
||||
* Message tag | Capability
|
||||
* ----------- | ----------
|
||||
* \c time | \l CClient::HasServerTime() (<a href="http://ircv3.net/specs/extensions/server-time-3.2.html">server-time</a>)
|
||||
* \c batch | \l CClient::HasBatch() (<a href="http://ircv3.net/specs/extensions/batch-3.2.html">batch</a>)
|
||||
*
|
||||
* @warning Bypassing the filter may cause troubles to some older IRC clients.
|
||||
*
|
||||
* It is possible to bypass the filter by converting a message to a string
|
||||
* using \l CMessage::ToString(), and passing the resulting raw line to the
|
||||
* \l CClient::PutClient(const CString& sLine) overload:
|
||||
* \code
|
||||
* pClient->PutClient(Message.ToString());
|
||||
* \endcode
|
||||
*/
|
||||
* @param Message The message to be sent.
|
||||
* @note Only known and compatible messages and tags are sent.
|
||||
* @return \c true if the message was sent, or \c false if it was ignored.
|
||||
*
|
||||
* This method ensures that only messages and tags, that the client has
|
||||
* explicitly requested, are sent. Not all IRC clients are capable of
|
||||
* handling all messages and tags. For example, some older versions of
|
||||
* popular clients were prepared to parse just one interesting tag,
|
||||
* \c time, and would break if multiple tags were included. Furthermore,
|
||||
* messages that are specific to a certain capability, should not be sent
|
||||
* to a client that has not requested the respective capability. Thus, in
|
||||
* order to stay compatible with a variety of IRC clients, ZNC has to
|
||||
* filter out messages and tags that the client has not explicitly
|
||||
* requested.
|
||||
*
|
||||
* ### Message types
|
||||
*
|
||||
* The following table documents which capabilities the client is required
|
||||
* to have requested in order to receive certain types of messages.
|
||||
*
|
||||
* Message type | Capability
|
||||
* ------------ | ----------
|
||||
* \c ACCOUNT | \l CClient::HasAccountNotify() (<a href="http://ircv3.net/specs/extensions/account-notify-3.1.html">account-notify</a>)
|
||||
* \c AWAY | \l CClient::HasAwayNotify() (<a href="http://ircv3.net/specs/extensions/away-notify-3.1.html">away-notify</a>)
|
||||
*
|
||||
* ### Message tags
|
||||
*
|
||||
* The following table documents currently supported message tags, and
|
||||
* which capabilities the client is required to have requested to receive
|
||||
* the respective message tags.
|
||||
*
|
||||
* Message tag | Capability
|
||||
* ----------- | ----------
|
||||
* \c time | \l CClient::HasServerTime() (<a href="http://ircv3.net/specs/extensions/server-time-3.2.html">server-time</a>)
|
||||
* \c batch | \l CClient::HasBatch() (<a href="http://ircv3.net/specs/extensions/batch-3.2.html">batch</a>)
|
||||
*
|
||||
* @warning Bypassing the filter may cause troubles to some older IRC clients.
|
||||
*
|
||||
* It is possible to bypass the filter by converting a message to a string
|
||||
* using \l CMessage::ToString(), and passing the resulting raw line to the
|
||||
* \l CClient::PutClient(const CString& sLine) overload:
|
||||
* \code
|
||||
* pClient->PutClient(Message.ToString());
|
||||
* \endcode
|
||||
*/
|
||||
bool PutClient(const CMessage& Message);
|
||||
unsigned int PutStatus(const CTable& table);
|
||||
void PutStatus(const CString& sLine);
|
||||
|
||||
@@ -55,8 +55,8 @@ class CIRCNetwork {
|
||||
/** Time between checks if PINGs need to be sent */
|
||||
PING_SLACK = 30,
|
||||
/** Timeout after which IRC connections are closed. Must
|
||||
* obviously be greater than PING_FREQUENCY + PING_SLACK.
|
||||
*/
|
||||
* obviously be greater than PING_FREQUENCY + PING_SLACK.
|
||||
*/
|
||||
NO_TRAFFIC_TIMEOUT = 180
|
||||
};
|
||||
|
||||
@@ -158,7 +158,7 @@ class CIRCNetwork {
|
||||
|
||||
bool Connect();
|
||||
/** This method will return whether the user is connected and authenticated to an IRC server.
|
||||
*/
|
||||
*/
|
||||
bool IsIRCConnected() const;
|
||||
void SetIRCSocket(CIRCSock* pIRCSock);
|
||||
void IRCConnected();
|
||||
|
||||
@@ -63,13 +63,13 @@ class CIRCSock : public CIRCSocket {
|
||||
void Quit(const CString& sQuitMsg = "");
|
||||
|
||||
/** You can call this from CModule::OnServerCapResult to suspend
|
||||
* sending other CAP requests and CAP END for a while. Each
|
||||
* call to PauseCap should be balanced with a call to ResumeCap.
|
||||
*/
|
||||
* sending other CAP requests and CAP END for a while. Each
|
||||
* call to PauseCap should be balanced with a call to ResumeCap.
|
||||
*/
|
||||
void PauseCap();
|
||||
/** If you used PauseCap, call this when CAP negotiation and logging in
|
||||
* should be resumed again.
|
||||
*/
|
||||
* should be resumed again.
|
||||
*/
|
||||
void ResumeCap();
|
||||
|
||||
// Setters
|
||||
|
||||
+412
-412
File diff suppressed because it is too large
Load Diff
+18
-18
@@ -232,17 +232,17 @@ class CSockManager : public TSocketManager<CZNCSock> {
|
||||
class CSocket : public CZNCSock {
|
||||
public:
|
||||
/**
|
||||
* @brief ctor
|
||||
* @param pModule the module this sock instance is associated to
|
||||
*/
|
||||
* @brief ctor
|
||||
* @param pModule the module this sock instance is associated to
|
||||
*/
|
||||
CSocket(CModule* pModule);
|
||||
/**
|
||||
* @brief ctor
|
||||
* @param pModule the module this sock instance is associated to
|
||||
* @param sHostname the hostname being connected to
|
||||
* @param uPort the port being connected to
|
||||
* @param iTimeout the timeout period for this specific sock
|
||||
*/
|
||||
* @brief ctor
|
||||
* @param pModule the module this sock instance is associated to
|
||||
* @param sHostname the hostname being connected to
|
||||
* @param uPort the port being connected to
|
||||
* @param iTimeout the timeout period for this specific sock
|
||||
*/
|
||||
CSocket(CModule* pModule, const CString& sHostname, unsigned short uPort,
|
||||
int iTimeout = 60);
|
||||
virtual ~CSocket();
|
||||
@@ -283,15 +283,15 @@ class CIRCSocket : public CZNCSock {
|
||||
public:
|
||||
#ifdef HAVE_ICU
|
||||
/**
|
||||
* @brief Allow IRC control characters to appear even if protocol encoding explicitly disallows them.
|
||||
*
|
||||
* E.g. ISO-2022-JP disallows 0x0F, which in IRC means "reset format",
|
||||
* so by default it gets replaced with U+FFFD ("replacement character").
|
||||
* https://code.google.com/p/chromium/issues/detail?id=277062#c3
|
||||
*
|
||||
* In case if protocol encoding uses these code points for something else, the encoding takes preference,
|
||||
* and they are not IRC control characters anymore.
|
||||
*/
|
||||
* @brief Allow IRC control characters to appear even if protocol encoding explicitly disallows them.
|
||||
*
|
||||
* E.g. ISO-2022-JP disallows 0x0F, which in IRC means "reset format",
|
||||
* so by default it gets replaced with U+FFFD ("replacement character").
|
||||
* https://code.google.com/p/chromium/issues/detail?id=277062#c3
|
||||
*
|
||||
* In case if protocol encoding uses these code points for something else, the encoding takes preference,
|
||||
* and they are not IRC control characters anymore.
|
||||
*/
|
||||
void IcuExtToUCallback(UConverterToUnicodeArgs* toArgs,
|
||||
const char* codeUnits, int32_t length,
|
||||
UConverterCallbackReason reason,
|
||||
|
||||
+59
-59
@@ -135,41 +135,41 @@ class CException {
|
||||
class CTable : protected std::vector<std::vector<CString>> {
|
||||
public:
|
||||
/** Constructor
|
||||
*
|
||||
* @param uPreferredWidth If width of table is bigger than this, text in cells will be wrapped to several lines, if possible
|
||||
*/
|
||||
*
|
||||
* @param uPreferredWidth If width of table is bigger than this, text in cells will be wrapped to several lines, if possible
|
||||
*/
|
||||
CTable() : m_vsHeaders(), m_vsOutput() {}
|
||||
virtual ~CTable() {}
|
||||
|
||||
/** Adds a new column to the table.
|
||||
* Please note that you should add all columns before starting to fill
|
||||
* the table!
|
||||
* @param sName The name of the column.
|
||||
* @return false if a column by that name already existed.
|
||||
*/
|
||||
* Please note that you should add all columns before starting to fill
|
||||
* the table!
|
||||
* @param sName The name of the column.
|
||||
* @return false if a column by that name already existed.
|
||||
*/
|
||||
bool AddColumn(const CString& sName);
|
||||
|
||||
/** Adds a new row to the table.
|
||||
* After calling this you can fill the row with content.
|
||||
* @return The index of this row
|
||||
*/
|
||||
* After calling this you can fill the row with content.
|
||||
* @return The index of this row
|
||||
*/
|
||||
size_type AddRow();
|
||||
|
||||
/** Sets a given cell in the table to a value.
|
||||
* @param sColumn The name of the column you want to fill.
|
||||
* @param sValue The value to write into that column.
|
||||
* @param uRowIdx The index of the row to use as returned by AddRow().
|
||||
* If this is not given, the last row will be used.
|
||||
* @return True if setting the cell was successful.
|
||||
*/
|
||||
* @param sColumn The name of the column you want to fill.
|
||||
* @param sValue The value to write into that column.
|
||||
* @param uRowIdx The index of the row to use as returned by AddRow().
|
||||
* If this is not given, the last row will be used.
|
||||
* @return True if setting the cell was successful.
|
||||
*/
|
||||
bool SetCell(const CString& sColumn, const CString& sValue,
|
||||
size_type uRowIdx = ~0);
|
||||
|
||||
/** Get a line of the table's output
|
||||
* @param uIdx The index of the line you want.
|
||||
* @param sLine This string will receive the output.
|
||||
* @return True unless uIdx is past the end of the table.
|
||||
*/
|
||||
* @param uIdx The index of the line you want.
|
||||
* @param sLine This string will receive the output.
|
||||
* @return True unless uIdx is past the end of the table.
|
||||
*/
|
||||
bool GetLine(unsigned int uIdx, CString& sLine) const;
|
||||
|
||||
/// Completely clear the table.
|
||||
@@ -199,10 +199,10 @@ class CTable : protected std::vector<std::vector<CString>> {
|
||||
class CBlowfish {
|
||||
public:
|
||||
/**
|
||||
* @param sPassword key to encrypt with
|
||||
* @param iEncrypt encrypt method (BF_DECRYPT or BF_ENCRYPT)
|
||||
* @param sIvec what to set the ivector to start with, default sets it all 0's
|
||||
*/
|
||||
* @param sPassword key to encrypt with
|
||||
* @param iEncrypt encrypt method (BF_DECRYPT or BF_ENCRYPT)
|
||||
* @param sIvec what to set the ivector to start with, default sets it all 0's
|
||||
*/
|
||||
CBlowfish(const CString& sPassword, int iEncrypt,
|
||||
const CString& sIvec = "");
|
||||
~CBlowfish();
|
||||
@@ -244,31 +244,31 @@ class TCacheMap {
|
||||
virtual ~TCacheMap() {}
|
||||
|
||||
/**
|
||||
* @brief This function adds an item to the cache using the default time-to-live value
|
||||
* @param Item the item to add to the cache
|
||||
*/
|
||||
* @brief This function adds an item to the cache using the default time-to-live value
|
||||
* @param Item the item to add to the cache
|
||||
*/
|
||||
void AddItem(const K& Item) { AddItem(Item, m_uTTL); }
|
||||
|
||||
/**
|
||||
* @brief This function adds an item to the cache using a custom time-to-live value
|
||||
* @param Item the item to add to the cache
|
||||
* @param uTTL the time-to-live for this specific item
|
||||
*/
|
||||
* @brief This function adds an item to the cache using a custom time-to-live value
|
||||
* @param Item the item to add to the cache
|
||||
* @param uTTL the time-to-live for this specific item
|
||||
*/
|
||||
void AddItem(const K& Item, unsigned int uTTL) { AddItem(Item, V(), uTTL); }
|
||||
|
||||
/**
|
||||
* @brief This function adds an item to the cache using the default time-to-live value
|
||||
* @param Item the item to add to the cache
|
||||
* @param Val The value associated with the key Item
|
||||
*/
|
||||
* @brief This function adds an item to the cache using the default time-to-live value
|
||||
* @param Item the item to add to the cache
|
||||
* @param Val The value associated with the key Item
|
||||
*/
|
||||
void AddItem(const K& Item, const V& Val) { AddItem(Item, Val, m_uTTL); }
|
||||
|
||||
/**
|
||||
* @brief This function adds an item to the cache using a custom time-to-live value
|
||||
* @param Item the item to add to the cache
|
||||
* @param Val The value associated with the key Item
|
||||
* @param uTTL the time-to-live for this specific item
|
||||
*/
|
||||
* @brief This function adds an item to the cache using a custom time-to-live value
|
||||
* @param Item the item to add to the cache
|
||||
* @param Val The value associated with the key Item
|
||||
* @param uTTL the time-to-live for this specific item
|
||||
*/
|
||||
void AddItem(const K& Item, const V& Val, unsigned int uTTL) {
|
||||
if (!uTTL) {
|
||||
// If time-to-live is zero we don't want to waste our time adding
|
||||
@@ -281,20 +281,20 @@ class TCacheMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs a Cleanup() and then checks to see if your item exists
|
||||
* @param Item The item to check for
|
||||
* @return true if item exists
|
||||
*/
|
||||
* @brief Performs a Cleanup() and then checks to see if your item exists
|
||||
* @param Item The item to check for
|
||||
* @return true if item exists
|
||||
*/
|
||||
bool HasItem(const K& Item) {
|
||||
Cleanup();
|
||||
return (m_mItems.find(Item) != m_mItems.end());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs a Cleanup() and returns a pointer to the object, or nullptr
|
||||
* @param Item The item to check for
|
||||
* @return Pointer to the item or nullptr if there is no suitable one
|
||||
*/
|
||||
* @brief Performs a Cleanup() and returns a pointer to the object, or nullptr
|
||||
* @param Item The item to check for
|
||||
* @return Pointer to the item or nullptr if there is no suitable one
|
||||
*/
|
||||
V* GetItem(const K& Item) {
|
||||
Cleanup();
|
||||
iterator it = m_mItems.find(Item);
|
||||
@@ -303,15 +303,15 @@ class TCacheMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Removes a specific item from the cache
|
||||
* @param Item The item to be removed
|
||||
* @return true if item existed and was removed, false if it never existed
|
||||
*/
|
||||
* @brief Removes a specific item from the cache
|
||||
* @param Item The item to be removed
|
||||
* @return true if item existed and was removed, false if it never existed
|
||||
*/
|
||||
bool RemItem(const K& Item) { return (m_mItems.erase(Item) != 0); }
|
||||
|
||||
/**
|
||||
* @brief Cycles through the queue removing all of the stale entries
|
||||
*/
|
||||
* @brief Cycles through the queue removing all of the stale entries
|
||||
*/
|
||||
void Cleanup() {
|
||||
iterator it = m_mItems.begin();
|
||||
|
||||
@@ -325,13 +325,13 @@ class TCacheMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear all entries
|
||||
*/
|
||||
* @brief Clear all entries
|
||||
*/
|
||||
void Clear() { m_mItems.clear(); }
|
||||
|
||||
/**
|
||||
* @brief Returns all entries
|
||||
*/
|
||||
* @brief Returns all entries
|
||||
*/
|
||||
std::map<K, V> GetItems() {
|
||||
Cleanup();
|
||||
std::map<K, V> mItems;
|
||||
|
||||
+288
-288
@@ -105,11 +105,11 @@ class CString : public std::string {
|
||||
~CString() {}
|
||||
|
||||
/**
|
||||
* Casts a CString to another type. Implemented via std::stringstream, you use this
|
||||
* for any class that has an operator<<(std::ostream, YourClass).
|
||||
* @param target The object to cast into. If the cast fails, its state is unspecified.
|
||||
* @return True if the cast succeeds, and false if it fails.
|
||||
*/
|
||||
* Casts a CString to another type. Implemented via std::stringstream, you use this
|
||||
* for any class that has an operator<<(std::ostream, YourClass).
|
||||
* @param target The object to cast into. If the cast fails, its state is unspecified.
|
||||
* @return True if the cast succeeds, and false if it fails.
|
||||
*/
|
||||
template <typename T>
|
||||
bool Convert(T* target) const {
|
||||
std::stringstream ss(*this);
|
||||
@@ -118,12 +118,12 @@ class CString : public std::string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Joins a collection of objects together, using 'this' as a delimiter.
|
||||
* You can pass either pointers to arrays, or iterators to collections.
|
||||
* @param i_begin An iterator pointing to the beginning of a group of objects.
|
||||
* @param i_end An iterator pointing past the end of a group of objects.
|
||||
* @return The joined string
|
||||
*/
|
||||
* Joins a collection of objects together, using 'this' as a delimiter.
|
||||
* You can pass either pointers to arrays, or iterators to collections.
|
||||
* @param i_begin An iterator pointing to the beginning of a group of objects.
|
||||
* @param i_end An iterator pointing past the end of a group of objects.
|
||||
* @return The joined string
|
||||
*/
|
||||
template <typename Iterator>
|
||||
CString Join(Iterator i_start, const Iterator& i_end) const {
|
||||
if (i_start == i_end) return CString("");
|
||||
@@ -138,80 +138,80 @@ class CString : public std::string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare this string caselessly to some other string.
|
||||
* @param s The string to compare to.
|
||||
* @param uLen The number of characters to compare.
|
||||
* @return An integer less than, equal to, or greater than zero if this
|
||||
* string smaller, equal.... to the given string.
|
||||
*/
|
||||
* Compare this string caselessly to some other string.
|
||||
* @param s The string to compare to.
|
||||
* @param uLen The number of characters to compare.
|
||||
* @return An integer less than, equal to, or greater than zero if this
|
||||
* string smaller, equal.... to the given string.
|
||||
*/
|
||||
int CaseCmp(const CString& s,
|
||||
CString::size_type uLen = CString::npos) const;
|
||||
/**
|
||||
* Compare this string case sensitively to some other string.
|
||||
* @param s The string to compare to.
|
||||
* @param uLen The number of characters to compare.
|
||||
* @return An integer less than, equal to, or greater than zero if this
|
||||
* string smaller, equal.... to the given string.
|
||||
*/
|
||||
* Compare this string case sensitively to some other string.
|
||||
* @param s The string to compare to.
|
||||
* @param uLen The number of characters to compare.
|
||||
* @return An integer less than, equal to, or greater than zero if this
|
||||
* string smaller, equal.... to the given string.
|
||||
*/
|
||||
int StrCmp(const CString& s, CString::size_type uLen = CString::npos) const;
|
||||
/**
|
||||
* Check if this string is equal to some other string.
|
||||
* @param s The string to compare to.
|
||||
* @param cs CaseSensitive if you want the comparison to be case
|
||||
* sensitive, CaseInsensitive (default) otherwise.
|
||||
* @return True if the strings are equal.
|
||||
*/
|
||||
* Check if this string is equal to some other string.
|
||||
* @param s The string to compare to.
|
||||
* @param cs CaseSensitive if you want the comparison to be case
|
||||
* sensitive, CaseInsensitive (default) otherwise.
|
||||
* @return True if the strings are equal.
|
||||
*/
|
||||
bool Equals(const CString& s, CaseSensitivity cs = CaseInsensitive) const;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
* @deprecated
|
||||
*/
|
||||
bool Equals(const CString& s, bool bCaseSensitive,
|
||||
CString::size_type uLen = CString::npos) const;
|
||||
/**
|
||||
* Do a wildcard comparison between two strings.
|
||||
* For example, the following returns true:
|
||||
* <code>WildCmp("*!?bar@foo", "I_am!~bar@foo");</code>
|
||||
* @param sWild The wildcards used for the comparison.
|
||||
* @param sString The string that is used for comparing.
|
||||
* @param cs CaseSensitive (default) if you want the comparison
|
||||
* to be case sensitive, CaseInsensitive otherwise.
|
||||
* @todo Make cs CaseInsensitive by default.
|
||||
* @return true if the wildcard matches.
|
||||
*/
|
||||
* Do a wildcard comparison between two strings.
|
||||
* For example, the following returns true:
|
||||
* <code>WildCmp("*!?bar@foo", "I_am!~bar@foo");</code>
|
||||
* @param sWild The wildcards used for the comparison.
|
||||
* @param sString The string that is used for comparing.
|
||||
* @param cs CaseSensitive (default) if you want the comparison
|
||||
* to be case sensitive, CaseInsensitive otherwise.
|
||||
* @todo Make cs CaseInsensitive by default.
|
||||
* @return true if the wildcard matches.
|
||||
*/
|
||||
static bool WildCmp(const CString& sWild, const CString& sString,
|
||||
CaseSensitivity cs = CaseSensitive);
|
||||
/**
|
||||
* Do a wild compare on this string.
|
||||
* @param sWild The wildcards used to for the comparison.
|
||||
* @param cs CaseSensitive (default) if you want the comparison
|
||||
* to be case sensitive, CaseInsensitive otherwise.
|
||||
* @todo Make cs CaseInsensitive by default.
|
||||
* @return The result of <code>this->WildCmp(sWild, *this);</code>.
|
||||
*/
|
||||
* Do a wild compare on this string.
|
||||
* @param sWild The wildcards used to for the comparison.
|
||||
* @param cs CaseSensitive (default) if you want the comparison
|
||||
* to be case sensitive, CaseInsensitive otherwise.
|
||||
* @todo Make cs CaseInsensitive by default.
|
||||
* @return The result of <code>this->WildCmp(sWild, *this);</code>.
|
||||
*/
|
||||
bool WildCmp(const CString& sWild,
|
||||
CaseSensitivity cs = CaseSensitive) const;
|
||||
|
||||
/**
|
||||
* Turn all characters in this string into their upper-case equivalent.
|
||||
* @returns A reference to *this.
|
||||
*/
|
||||
* Turn all characters in this string into their upper-case equivalent.
|
||||
* @returns A reference to *this.
|
||||
*/
|
||||
CString& MakeUpper();
|
||||
/**
|
||||
* Turn all characters in this string into their lower-case equivalent.
|
||||
* @returns A reference to *this.
|
||||
*/
|
||||
* Turn all characters in this string into their lower-case equivalent.
|
||||
* @returns A reference to *this.
|
||||
*/
|
||||
CString& MakeLower();
|
||||
/**
|
||||
* Return a copy of this string with all characters turned into
|
||||
* upper-case.
|
||||
* @return The new string.
|
||||
*/
|
||||
* Return a copy of this string with all characters turned into
|
||||
* upper-case.
|
||||
* @return The new string.
|
||||
*/
|
||||
CString AsUpper() const;
|
||||
/**
|
||||
* Return a copy of this string with all characters turned into
|
||||
* lower-case.
|
||||
* @return The new string.
|
||||
*/
|
||||
* Return a copy of this string with all characters turned into
|
||||
* lower-case.
|
||||
* @return The new string.
|
||||
*/
|
||||
CString AsLower() const;
|
||||
|
||||
static EEscape ToEscape(const CString& sEsc);
|
||||
@@ -221,100 +221,100 @@ class CString : public std::string {
|
||||
CString& Escape(EEscape eTo);
|
||||
|
||||
/** Replace all occurrences in a string.
|
||||
*
|
||||
* You can specify a "safe zone" via sLeft and sRight. Anything inside
|
||||
* of such a zone will not be replaced. This does not do recursion, so
|
||||
* e.g. with <code>Replace("(a()a)", "a", "b", "(", ")", true)</code>
|
||||
* you would get "a(b)" as result. The second opening brace and the
|
||||
* second closing brace would not be seen as a delimitered and thus
|
||||
* wouldn't be removed. The first a is inside a "safe zone" and thus is
|
||||
* left alone, too.
|
||||
*
|
||||
* @param sStr The string to do the replacing on. This will also contain
|
||||
* the result when this function returns.
|
||||
* @param sReplace The string that should be replaced.
|
||||
* @param sWith The replacement to use.
|
||||
* @param sLeft The string that marks the begin of the "safe zone".
|
||||
* @param sRight The string that marks the end of the "safe zone".
|
||||
* @param bRemoveDelims If this is true, all matches for sLeft and
|
||||
* sRight are removed.
|
||||
* @returns The number of replacements done.
|
||||
*/
|
||||
*
|
||||
* You can specify a "safe zone" via sLeft and sRight. Anything inside
|
||||
* of such a zone will not be replaced. This does not do recursion, so
|
||||
* e.g. with <code>Replace("(a()a)", "a", "b", "(", ")", true)</code>
|
||||
* you would get "a(b)" as result. The second opening brace and the
|
||||
* second closing brace would not be seen as a delimitered and thus
|
||||
* wouldn't be removed. The first a is inside a "safe zone" and thus is
|
||||
* left alone, too.
|
||||
*
|
||||
* @param sStr The string to do the replacing on. This will also contain
|
||||
* the result when this function returns.
|
||||
* @param sReplace The string that should be replaced.
|
||||
* @param sWith The replacement to use.
|
||||
* @param sLeft The string that marks the begin of the "safe zone".
|
||||
* @param sRight The string that marks the end of the "safe zone".
|
||||
* @param bRemoveDelims If this is true, all matches for sLeft and
|
||||
* sRight are removed.
|
||||
* @returns The number of replacements done.
|
||||
*/
|
||||
static unsigned int Replace(CString& sStr, const CString& sReplace,
|
||||
const CString& sWith, const CString& sLeft = "",
|
||||
const CString& sRight = "",
|
||||
bool bRemoveDelims = false);
|
||||
|
||||
/** Replace all occurrences in the current string.
|
||||
* @see CString::Replace
|
||||
* @param sReplace The string to look for.
|
||||
* @param sWith The replacement to use.
|
||||
* @param sLeft The delimiter at the beginning of a safe zone.
|
||||
* @param sRight The delimiter at the end of a safe zone.
|
||||
* @param bRemoveDelims If true, all matching delimiters are removed.
|
||||
* @return The result of the replacing. The current string is left
|
||||
* unchanged.
|
||||
*/
|
||||
* @see CString::Replace
|
||||
* @param sReplace The string to look for.
|
||||
* @param sWith The replacement to use.
|
||||
* @param sLeft The delimiter at the beginning of a safe zone.
|
||||
* @param sRight The delimiter at the end of a safe zone.
|
||||
* @param bRemoveDelims If true, all matching delimiters are removed.
|
||||
* @return The result of the replacing. The current string is left
|
||||
* unchanged.
|
||||
*/
|
||||
CString Replace_n(const CString& sReplace, const CString& sWith,
|
||||
const CString& sLeft = "", const CString& sRight = "",
|
||||
bool bRemoveDelims = false) const;
|
||||
/** Replace all occurrences in the current string.
|
||||
* @see CString::Replace
|
||||
* @param sReplace The string to look for.
|
||||
* @param sWith The replacement to use.
|
||||
* @param sLeft The delimiter at the beginning of a safe zone.
|
||||
* @param sRight The delimiter at the end of a safe zone.
|
||||
* @param bRemoveDelims If true, all matching delimiters are removed.
|
||||
* @returns The number of replacements done.
|
||||
*/
|
||||
* @see CString::Replace
|
||||
* @param sReplace The string to look for.
|
||||
* @param sWith The replacement to use.
|
||||
* @param sLeft The delimiter at the beginning of a safe zone.
|
||||
* @param sRight The delimiter at the end of a safe zone.
|
||||
* @param bRemoveDelims If true, all matching delimiters are removed.
|
||||
* @returns The number of replacements done.
|
||||
*/
|
||||
unsigned int Replace(const CString& sReplace, const CString& sWith,
|
||||
const CString& sLeft = "", const CString& sRight = "",
|
||||
bool bRemoveDelims = false);
|
||||
/** Ellipsize the current string.
|
||||
* For example, ellipsizing "Hello, I'm Bob" to the length 9 would
|
||||
* result in "Hello,...".
|
||||
* @param uLen The length to ellipsize to.
|
||||
* @return The ellipsized string.
|
||||
*/
|
||||
* For example, ellipsizing "Hello, I'm Bob" to the length 9 would
|
||||
* result in "Hello,...".
|
||||
* @param uLen The length to ellipsize to.
|
||||
* @return The ellipsized string.
|
||||
*/
|
||||
CString Ellipsize(unsigned int uLen) const;
|
||||
/** Return the left part of the string.
|
||||
* @param uCount The number of characters to keep.
|
||||
* @return The resulting string.
|
||||
*/
|
||||
* @param uCount The number of characters to keep.
|
||||
* @return The resulting string.
|
||||
*/
|
||||
CString Left(size_type uCount) const;
|
||||
/** Return the right part of the string.
|
||||
* @param uCount The number of characters to keep.
|
||||
* @return The resulting string.
|
||||
*/
|
||||
* @param uCount The number of characters to keep.
|
||||
* @return The resulting string.
|
||||
*/
|
||||
CString Right(size_type uCount) const;
|
||||
|
||||
/** Get the first line of this string.
|
||||
* @return The first line of text.
|
||||
*/
|
||||
* @return The first line of text.
|
||||
*/
|
||||
CString FirstLine() const { return Token(0, false, "\n"); }
|
||||
|
||||
/** Get a token out of this string. For example in the string "a bc d e",
|
||||
* each of "a", "bc", "d" and "e" are tokens.
|
||||
* @param uPos The number of the token you are interested. The first
|
||||
* token has a position of 0.
|
||||
* @param bRest If false, only the token you asked for is returned. Else
|
||||
* you get the substring starting from the beginning of
|
||||
* your token.
|
||||
* @param sSep Seperator between tokens.
|
||||
* @param bAllowEmpty If this is true, empty tokens are allowed. In the
|
||||
* example from above this means that there is a
|
||||
* token "" before the "e" token.
|
||||
* @return The token you asked for and, if bRest is true, everything
|
||||
* after it.
|
||||
* @see Split() if you need a string split into all of its tokens.
|
||||
*/
|
||||
* each of "a", "bc", "d" and "e" are tokens.
|
||||
* @param uPos The number of the token you are interested. The first
|
||||
* token has a position of 0.
|
||||
* @param bRest If false, only the token you asked for is returned. Else
|
||||
* you get the substring starting from the beginning of
|
||||
* your token.
|
||||
* @param sSep Seperator between tokens.
|
||||
* @param bAllowEmpty If this is true, empty tokens are allowed. In the
|
||||
* example from above this means that there is a
|
||||
* token "" before the "e" token.
|
||||
* @return The token you asked for and, if bRest is true, everything
|
||||
* after it.
|
||||
* @see Split() if you need a string split into all of its tokens.
|
||||
*/
|
||||
CString Token(size_t uPos, bool bRest = false, const CString& sSep = " ",
|
||||
bool bAllowEmpty = false) const;
|
||||
|
||||
/** Get a token out of this string. This function behaves much like the
|
||||
* other Token() function in this class. The extra arguments are
|
||||
* handled similarly to Split().
|
||||
*/
|
||||
* other Token() function in this class. The extra arguments are
|
||||
* handled similarly to Split().
|
||||
*/
|
||||
CString Token(size_t uPos, bool bRest, const CString& sSep,
|
||||
bool bAllowEmpty, const CString& sLeft, const CString& sRight,
|
||||
bool bTrimQuotes = true) const;
|
||||
@@ -324,49 +324,49 @@ class CString : public std::string {
|
||||
size_type QuoteSplit(VCString& vsRet) const;
|
||||
|
||||
/** Split up this string into tokens.
|
||||
* Via sLeft and sRight you can define "markers" like with Replace().
|
||||
* Anything in such a marked section is treated as a single token. All
|
||||
* occurences of sDelim in such a block are ignored.
|
||||
* @param sDelim Delimiter between tokens.
|
||||
* @param vsRet Vector for returning the result.
|
||||
* @param bAllowEmpty Do empty tokens count as a valid token?
|
||||
* @param sLeft Left delimiter like with Replace().
|
||||
* @param sRight Right delimiter like with Replace().
|
||||
* @param bTrimQuotes Should sLeft and sRight be removed from the token
|
||||
* they mark?
|
||||
* @param bTrimWhiteSpace If this is true, CString::Trim() is called on
|
||||
* each token.
|
||||
* @return The number of tokens found.
|
||||
*/
|
||||
* Via sLeft and sRight you can define "markers" like with Replace().
|
||||
* Anything in such a marked section is treated as a single token. All
|
||||
* occurences of sDelim in such a block are ignored.
|
||||
* @param sDelim Delimiter between tokens.
|
||||
* @param vsRet Vector for returning the result.
|
||||
* @param bAllowEmpty Do empty tokens count as a valid token?
|
||||
* @param sLeft Left delimiter like with Replace().
|
||||
* @param sRight Right delimiter like with Replace().
|
||||
* @param bTrimQuotes Should sLeft and sRight be removed from the token
|
||||
* they mark?
|
||||
* @param bTrimWhiteSpace If this is true, CString::Trim() is called on
|
||||
* each token.
|
||||
* @return The number of tokens found.
|
||||
*/
|
||||
size_type Split(const CString& sDelim, VCString& vsRet,
|
||||
bool bAllowEmpty = true, const CString& sLeft = "",
|
||||
const CString& sRight = "", bool bTrimQuotes = true,
|
||||
bool bTrimWhiteSpace = false) const;
|
||||
|
||||
/** Split up this string into tokens.
|
||||
* This function is identical to the other CString::Split(), except that
|
||||
* the result is returned as a SCString instead of a VCString.
|
||||
*/
|
||||
* This function is identical to the other CString::Split(), except that
|
||||
* the result is returned as a SCString instead of a VCString.
|
||||
*/
|
||||
size_type Split(const CString& sDelim, SCString& ssRet,
|
||||
bool bAllowEmpty = true, const CString& sLeft = "",
|
||||
const CString& sRight = "", bool bTrimQuotes = true,
|
||||
bool bTrimWhiteSpace = false) const;
|
||||
|
||||
/** Build a string from a format string, replacing values from a map.
|
||||
* The format specification can contain simple named parameters that match
|
||||
* keys in the given map. For example in the string "a {b} c", the key "b"
|
||||
* is looked up in the map, and inserted for "{b}".
|
||||
* @param sFormat The format specification.
|
||||
* @param msValues A map of named parameters to their values.
|
||||
* @return The string with named parameters replaced.
|
||||
*/
|
||||
* The format specification can contain simple named parameters that match
|
||||
* keys in the given map. For example in the string "a {b} c", the key "b"
|
||||
* is looked up in the map, and inserted for "{b}".
|
||||
* @param sFormat The format specification.
|
||||
* @param msValues A map of named parameters to their values.
|
||||
* @return The string with named parameters replaced.
|
||||
*/
|
||||
static CString NamedFormat(const CString& sFormat,
|
||||
const MCString& msValues);
|
||||
|
||||
/** Produces a random string.
|
||||
* @param uLength The length of the resulting string.
|
||||
* @return A random string.
|
||||
*/
|
||||
* @param uLength The length of the resulting string.
|
||||
* @return A random string.
|
||||
*/
|
||||
static CString RandomString(unsigned int uLength);
|
||||
|
||||
/** @return The MD5 hash of this string. */
|
||||
@@ -375,37 +375,37 @@ class CString : public std::string {
|
||||
CString SHA256() const;
|
||||
|
||||
/** Treat this string as base64-encoded data and decode it.
|
||||
* @param sRet String to which the result of the decode is safed.
|
||||
* @return The length of the resulting string.
|
||||
*/
|
||||
* @param sRet String to which the result of the decode is safed.
|
||||
* @return The length of the resulting string.
|
||||
*/
|
||||
unsigned long Base64Decode(CString& sRet) const;
|
||||
/** Treat this string as base64-encoded data and decode it.
|
||||
* The result is saved in this CString instance.
|
||||
* @return The length of the resulting string.
|
||||
*/
|
||||
* The result is saved in this CString instance.
|
||||
* @return The length of the resulting string.
|
||||
*/
|
||||
unsigned long Base64Decode();
|
||||
/** Treat this string as base64-encoded data and decode it.
|
||||
* @return The decoded string.
|
||||
*/
|
||||
* @return The decoded string.
|
||||
*/
|
||||
CString Base64Decode_n() const;
|
||||
/** Base64-encode the current string.
|
||||
* @param sRet String where the result is saved.
|
||||
* @param uWrap A boolean(!?!) that decides if the result should be
|
||||
* wrapped after everywhere 57 characters.
|
||||
* @return true unless this code is buggy.
|
||||
* @todo WTF @ uWrap.
|
||||
* @todo This only returns false if some formula we use was wrong?!
|
||||
*/
|
||||
* @param sRet String where the result is saved.
|
||||
* @param uWrap A boolean(!?!) that decides if the result should be
|
||||
* wrapped after everywhere 57 characters.
|
||||
* @return true unless this code is buggy.
|
||||
* @todo WTF @ uWrap.
|
||||
* @todo This only returns false if some formula we use was wrong?!
|
||||
*/
|
||||
bool Base64Encode(CString& sRet, unsigned int uWrap = 0) const;
|
||||
/** Base64-encode the current string.
|
||||
* This string is overwritten with the result of the encode.
|
||||
* @todo return value and param are as with Base64Encode() from above.
|
||||
*/
|
||||
* This string is overwritten with the result of the encode.
|
||||
* @todo return value and param are as with Base64Encode() from above.
|
||||
*/
|
||||
bool Base64Encode(unsigned int uWrap = 0);
|
||||
/** Base64-encode the current string
|
||||
* @todo uWrap is as broken as Base64Encode()'s uWrap.
|
||||
* @return The encoded string.
|
||||
*/
|
||||
* @todo uWrap is as broken as Base64Encode()'s uWrap.
|
||||
* @return The encoded string.
|
||||
*/
|
||||
CString Base64Encode_n(unsigned int uWrap = 0) const;
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
@@ -417,19 +417,19 @@ class CString : public std::string {
|
||||
#endif
|
||||
|
||||
/** Pretty-print a percent value.
|
||||
* @param d The percent value. This should be in range 0-100.
|
||||
* @return The "pretty" string.
|
||||
*/
|
||||
* @param d The percent value. This should be in range 0-100.
|
||||
* @return The "pretty" string.
|
||||
*/
|
||||
static CString ToPercent(double d);
|
||||
/** Pretty-print a number of bytes.
|
||||
* @param d The number of bytes.
|
||||
* @return A string describing the number of bytes.
|
||||
*/
|
||||
* @param d The number of bytes.
|
||||
* @return A string describing the number of bytes.
|
||||
*/
|
||||
static CString ToByteStr(unsigned long long d);
|
||||
/** Pretty-print a time span.
|
||||
* @param s Number of seconds to print.
|
||||
* @return A string like "4w 6d 4h 3m 58s".
|
||||
*/
|
||||
* @param s Number of seconds to print.
|
||||
* @return A string like "4w 6d 4h 3m 58s".
|
||||
*/
|
||||
static CString ToTimeStr(unsigned long s);
|
||||
|
||||
/** @return True if this string is not "false". */
|
||||
@@ -454,128 +454,128 @@ class CString : public std::string {
|
||||
double ToDouble() const;
|
||||
|
||||
/** Trim this string. All leading/trailing occurences of characters from
|
||||
* s are removed.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return true if this string was modified.
|
||||
*/
|
||||
* s are removed.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return true if this string was modified.
|
||||
*/
|
||||
bool Trim(const CString& s = " \t\r\n");
|
||||
/** Trim this string. All leading occurences of characters from s are
|
||||
* removed.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return true if this string was modified.
|
||||
*/
|
||||
* removed.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return true if this string was modified.
|
||||
*/
|
||||
bool TrimLeft(const CString& s = " \t\r\n");
|
||||
/** Trim this string. All trailing occurences of characters from s are
|
||||
* removed.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return true if this string was modified.
|
||||
*/
|
||||
* removed.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return true if this string was modified.
|
||||
*/
|
||||
bool TrimRight(const CString& s = " \t\r\n");
|
||||
/** Trim this string. All leading/trailing occurences of characters from
|
||||
* s are removed. This CString instance is not modified.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return The trimmed string.
|
||||
*/
|
||||
* s are removed. This CString instance is not modified.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return The trimmed string.
|
||||
*/
|
||||
CString Trim_n(const CString& s = " \t\r\n") const;
|
||||
/** Trim this string. All leading occurences of characters from s are
|
||||
* removed. This CString instance is not modified.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return The trimmed string.
|
||||
*/
|
||||
* removed. This CString instance is not modified.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return The trimmed string.
|
||||
*/
|
||||
CString TrimLeft_n(const CString& s = " \t\r\n") const;
|
||||
/** Trim this string. All trailing occurences of characters from s are
|
||||
* removed. This CString instance is not modified.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return The trimmed string.
|
||||
*/
|
||||
* removed. This CString instance is not modified.
|
||||
* @param s A list of characters that should be trimmed.
|
||||
* @return The trimmed string.
|
||||
*/
|
||||
CString TrimRight_n(const CString& s = " \t\r\n") const;
|
||||
|
||||
/** Trim a given prefix.
|
||||
* @param sPrefix The prefix that should be removed.
|
||||
* @return True if this string was modified.
|
||||
*/
|
||||
* @param sPrefix The prefix that should be removed.
|
||||
* @return True if this string was modified.
|
||||
*/
|
||||
bool TrimPrefix(const CString& sPrefix = ":");
|
||||
/** Trim a given suffix.
|
||||
* @param sSuffix The suffix that should be removed.
|
||||
* @return True if this string was modified.
|
||||
*/
|
||||
* @param sSuffix The suffix that should be removed.
|
||||
* @return True if this string was modified.
|
||||
*/
|
||||
bool TrimSuffix(const CString& sSuffix);
|
||||
/** Trim a given prefix.
|
||||
* @param sPrefix The prefix that should be removed.
|
||||
* @return A copy of this string without the prefix.
|
||||
*/
|
||||
* @param sPrefix The prefix that should be removed.
|
||||
* @return A copy of this string without the prefix.
|
||||
*/
|
||||
CString TrimPrefix_n(const CString& sPrefix = ":") const;
|
||||
/** Trim a given suffix.
|
||||
* @param sSuffix The suffix that should be removed.
|
||||
* @return A copy of this string without the prefix.
|
||||
*/
|
||||
* @param sSuffix The suffix that should be removed.
|
||||
* @return A copy of this string without the prefix.
|
||||
*/
|
||||
CString TrimSuffix_n(const CString& sSuffix) const;
|
||||
|
||||
/** Find the position of the given substring.
|
||||
* @param s The substring to search for.
|
||||
* @param cs CaseSensitive if you want the comparison to be case
|
||||
* sensitive, CaseInsensitive (default) otherwise.
|
||||
* @return The position of the substring if found, CString::npos otherwise.
|
||||
*/
|
||||
* @param s The substring to search for.
|
||||
* @param cs CaseSensitive if you want the comparison to be case
|
||||
* sensitive, CaseInsensitive (default) otherwise.
|
||||
* @return The position of the substring if found, CString::npos otherwise.
|
||||
*/
|
||||
size_t Find(const CString& s, CaseSensitivity cs = CaseInsensitive) const;
|
||||
/** Check whether the string starts with a given prefix.
|
||||
* @param sPrefix The prefix.
|
||||
* @param cs CaseSensitive if you want the comparison to be case
|
||||
* sensitive, CaseInsensitive (default) otherwise.
|
||||
* @return True if the string starts with prefix, false otherwise.
|
||||
*/
|
||||
* @param sPrefix The prefix.
|
||||
* @param cs CaseSensitive if you want the comparison to be case
|
||||
* sensitive, CaseInsensitive (default) otherwise.
|
||||
* @return True if the string starts with prefix, false otherwise.
|
||||
*/
|
||||
bool StartsWith(const CString& sPrefix,
|
||||
CaseSensitivity cs = CaseInsensitive) const;
|
||||
/** Check whether the string ends with a given suffix.
|
||||
* @param sSuffix The suffix.
|
||||
* @param cs CaseSensitive if you want the comparison to be case
|
||||
* sensitive, CaseInsensitive (default) otherwise.
|
||||
* @return True if the string ends with suffix, false otherwise.
|
||||
*/
|
||||
* @param sSuffix The suffix.
|
||||
* @param cs CaseSensitive if you want the comparison to be case
|
||||
* sensitive, CaseInsensitive (default) otherwise.
|
||||
* @return True if the string ends with suffix, false otherwise.
|
||||
*/
|
||||
bool EndsWith(const CString& sSuffix,
|
||||
CaseSensitivity cs = CaseInsensitive) const;
|
||||
/**
|
||||
* Check whether the string contains a given string.
|
||||
* @param s The string to search.
|
||||
* @param bCaseSensitive Whether the search is case sensitive.
|
||||
* @return True if this string contains the other string, falser otherwise.
|
||||
*/
|
||||
* Check whether the string contains a given string.
|
||||
* @param s The string to search.
|
||||
* @param bCaseSensitive Whether the search is case sensitive.
|
||||
* @return True if this string contains the other string, falser otherwise.
|
||||
*/
|
||||
bool Contains(const CString& s, CaseSensitivity cs = CaseInsensitive) const;
|
||||
|
||||
/** Remove characters from the beginning of this string.
|
||||
* @param uLen The number of characters to remove.
|
||||
* @return true if this string was modified.
|
||||
*/
|
||||
* @param uLen The number of characters to remove.
|
||||
* @return true if this string was modified.
|
||||
*/
|
||||
bool LeftChomp(size_type uLen = 1);
|
||||
/** Remove characters from the end of this string.
|
||||
* @param uLen The number of characters to remove.
|
||||
* @return true if this string was modified.
|
||||
*/
|
||||
* @param uLen The number of characters to remove.
|
||||
* @return true if this string was modified.
|
||||
*/
|
||||
bool RightChomp(size_type uLen = 1);
|
||||
/** Remove characters from the beginning of this string.
|
||||
* This string object isn't modified.
|
||||
* @param uLen The number of characters to remove.
|
||||
* @return The result of the conversion.
|
||||
*/
|
||||
* This string object isn't modified.
|
||||
* @param uLen The number of characters to remove.
|
||||
* @return The result of the conversion.
|
||||
*/
|
||||
CString LeftChomp_n(size_type uLen = 1) const;
|
||||
/** Remove characters from the end of this string.
|
||||
* This string object isn't modified.
|
||||
* @param uLen The number of characters to remove.
|
||||
* @return The result of the conversion.
|
||||
*/
|
||||
* This string object isn't modified.
|
||||
* @param uLen The number of characters to remove.
|
||||
* @return The result of the conversion.
|
||||
*/
|
||||
CString RightChomp_n(size_type uLen = 1) const;
|
||||
/** Remove controls characters from this string.
|
||||
* Controls characters are color codes, and those in C0 set
|
||||
* See https://en.wikipedia.org/wiki/C0_and_C1_control_codes
|
||||
* @return The result of the conversion.
|
||||
*/
|
||||
* Controls characters are color codes, and those in C0 set
|
||||
* See https://en.wikipedia.org/wiki/C0_and_C1_control_codes
|
||||
* @return The result of the conversion.
|
||||
*/
|
||||
CString& StripControls();
|
||||
/** Remove controls characters from this string.
|
||||
* Controls characters are color codes, and those in C0 set
|
||||
* See https://en.wikipedia.org/wiki/C0_and_C1_control_codes
|
||||
* This string object isn't modified.
|
||||
* @return The result of the conversion.
|
||||
*/
|
||||
* Controls characters are color codes, and those in C0 set
|
||||
* See https://en.wikipedia.org/wiki/C0_and_C1_control_codes
|
||||
* This string object isn't modified.
|
||||
* @return The result of the conversion.
|
||||
*/
|
||||
CString StripControls_n() const;
|
||||
|
||||
private:
|
||||
@@ -606,7 +606,7 @@ class MCString : public std::map<CString, CString> {
|
||||
static const MCString EmptyMap;
|
||||
|
||||
/** Status codes that can be returned by WriteToDisk() and
|
||||
* ReadFromDisk(). */
|
||||
* ReadFromDisk(). */
|
||||
enum status_t {
|
||||
/// No errors.
|
||||
MCS_SUCCESS = 0,
|
||||
@@ -621,43 +621,43 @@ class MCString : public std::map<CString, CString> {
|
||||
};
|
||||
|
||||
/** Write this map to a file.
|
||||
* @param sPath The file name to write to.
|
||||
* @param iMode The mode for the file.
|
||||
* @return The result of the operation.
|
||||
* @see WriteFilter.
|
||||
*/
|
||||
* @param sPath The file name to write to.
|
||||
* @param iMode The mode for the file.
|
||||
* @return The result of the operation.
|
||||
* @see WriteFilter.
|
||||
*/
|
||||
enum status_t WriteToDisk(const CString& sPath, mode_t iMode = 0644) const;
|
||||
/** Read a map from a file.
|
||||
* @param sPath The file name to read from.
|
||||
* @return The result of the operation.
|
||||
* @see ReadFilter.
|
||||
*/
|
||||
* @param sPath The file name to read from.
|
||||
* @return The result of the operation.
|
||||
* @see ReadFilter.
|
||||
*/
|
||||
enum status_t ReadFromDisk(const CString& sPath);
|
||||
|
||||
/** Filter used while writing this map. This function is called by
|
||||
* WriteToDisk() for each pair that is going to be written. This
|
||||
* function has the chance to modify the data that will be written.
|
||||
* @param sKey The key that will be written. Can be modified.
|
||||
* @param sValue The value that will be written. Can be modified.
|
||||
* @return true unless WriteToDisk() should fail with MCS_EWRITEFIL.
|
||||
*/
|
||||
* WriteToDisk() for each pair that is going to be written. This
|
||||
* function has the chance to modify the data that will be written.
|
||||
* @param sKey The key that will be written. Can be modified.
|
||||
* @param sValue The value that will be written. Can be modified.
|
||||
* @return true unless WriteToDisk() should fail with MCS_EWRITEFIL.
|
||||
*/
|
||||
virtual bool WriteFilter(CString& sKey, CString& sValue) const {
|
||||
return true;
|
||||
}
|
||||
/** Filter used while reading this map. This function is called by
|
||||
* ReadFromDisk() for each pair that is beging read. This function has
|
||||
* the chance to modify the data that is being read.
|
||||
* @param sKey The key that was read. Can be modified.
|
||||
* @param sValue The value that was read. Can be modified.
|
||||
* @return true unless ReadFromDisk() should fail with MCS_EWRITEFIL.
|
||||
*/
|
||||
* ReadFromDisk() for each pair that is beging read. This function has
|
||||
* the chance to modify the data that is being read.
|
||||
* @param sKey The key that was read. Can be modified.
|
||||
* @param sValue The value that was read. Can be modified.
|
||||
* @return true unless ReadFromDisk() should fail with MCS_EWRITEFIL.
|
||||
*/
|
||||
virtual bool ReadFilter(CString& sKey, CString& sValue) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Encode a value so that it can safely be parsed by ReadFromDisk().
|
||||
* This is an internal function.
|
||||
*/
|
||||
* This is an internal function.
|
||||
*/
|
||||
virtual CString& Encode(CString& sValue) const;
|
||||
/** Undo the effects of Encode(). This is an internal function. */
|
||||
virtual CString& Decode(CString& sValue) const;
|
||||
|
||||
+6
-6
@@ -180,12 +180,12 @@ class CZNC {
|
||||
CModule* FindModule(const CString& sModName, CUser* pUser);
|
||||
|
||||
/** Reload a module everywhere
|
||||
*
|
||||
* This method will unload a module globally, for a user and for each
|
||||
* network. It will then reload them all again.
|
||||
*
|
||||
* @param sModule The name of the module to reload
|
||||
*/
|
||||
*
|
||||
* This method will unload a module globally, for a user and for each
|
||||
* network. It will then reload them all again.
|
||||
*
|
||||
* @param sModule The name of the module to reload
|
||||
*/
|
||||
bool UpdateModule(const CString& sModule);
|
||||
|
||||
bool DeleteUser(const CString& sUsername);
|
||||
|
||||
+4
-4
@@ -845,10 +845,10 @@ CString CTemplate::GetValue(const CString& sArgs, bool bFromIf) {
|
||||
}
|
||||
|
||||
/* We have no CConfig in ZNC land
|
||||
* Hmm... Actually, we do have it now.
|
||||
if (msArgs.find("CONFIG") != msArgs.end()) {
|
||||
sRet = CConfig::GetValue(sName);
|
||||
} else*/ if (msArgs.find("ROWS") != msArgs.end()) {
|
||||
* Hmm... Actually, we do have it now.
|
||||
if (msArgs.find("CONFIG") != msArgs.end()) {
|
||||
sRet = CConfig::GetValue(sName);
|
||||
} else*/ if (msArgs.find("ROWS") != msArgs.end()) {
|
||||
vector<CTemplate*>* pLoop = GetLoop(sName);
|
||||
sRet = CString((pLoop) ? pLoop->size() : 0);
|
||||
} else if (msArgs.find("TOP") == msArgs.end() && pContext) {
|
||||
|
||||
Reference in New Issue
Block a user