diff options
| author | 2008-09-01 14:53:05 +0000 | |
|---|---|---|
| committer | 2008-09-01 14:53:05 +0000 | |
| commit | 4a0d8b9473fe27eee1af2e20f0fdaebc4f1d530e (patch) | |
| tree | dadbf46e377b868a33f22468f6bf7c40ea9a37b4 | |
| parent | indented code (diff) | |
| download | KVIrc-4a0d8b9473fe27eee1af2e20f0fdaebc4f1d530e.tar.gz KVIrc-4a0d8b9473fe27eee1af2e20f0fdaebc4f1d530e.tar.bz2 KVIrc-4a0d8b9473fe27eee1af2e20f0fdaebc4f1d530e.zip | |
added doxygen comments
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2378 17fca916-40b9-46aa-a4ea-0a15b648b75c
| -rw-r--r-- | TODO-doxygen | 6 | ||||
| -rw-r--r-- | src/kvilib/file/kvi_fileutils.h | 2 | ||||
| -rw-r--r-- | src/kvilib/irc/kvi_avatar.h | 176 | ||||
| -rw-r--r-- | src/kvilib/irc/kvi_avatarcache.h | 93 | ||||
| -rw-r--r-- | src/kvilib/irc/kvi_ircmask.cpp | 4 | ||||
| -rw-r--r-- | src/kvilib/irc/kvi_ircmask.h | 318 | ||||
| -rw-r--r-- | src/kvilib/system/kvi_env.cpp | 2 | ||||
| -rw-r--r-- | src/kvilib/system/kvi_env.h | 33 | ||||
| -rw-r--r-- | src/kvilib/system/kvi_process.h | 8 |
9 files changed, 451 insertions, 191 deletions
diff --git a/TODO-doxygen b/TODO-doxygen index b1ba4e69a..840ec09b9 100644 --- a/TODO-doxygen +++ b/TODO-doxygen @@ -26,14 +26,12 @@ ext/kvi_miscutils.h ext/kvi_mediatype.h ext/kvi_sharedfiles.h ext/kvi_regchan.h -irc/kvi_avatar.h -irc/kvi_ircmask.h +irc/kvi_ircmask.h - incomplete line 300 irc/kvi_ircserver.h irc/kvi_useridentity.h irc/kvi_ircuserdb.h irc/kvi_mirccntrl.h irc/kvi_ircserverdb.h -irc/kvi_avatarcache.h irc/kvi_network.h irc/kvi_nickserv.h net/kvi_sockettype.h @@ -88,13 +86,11 @@ core/kvi_string.h core/kvi_qstring.h - incomplete lines 56-61, 70-75 core/kvi_error.h - incomplete from line 36 to 185 file/kvi_file.h -system/kvi_env.h system/kvi_locale.h system/kvi_time.h system/kvi_stdarg.h system/kvi_byteorder.h system/kvi_thread.h -system/kvi_process.h config/kvi_settings.h config/kvi_debug.h diff --git a/src/kvilib/file/kvi_fileutils.h b/src/kvilib/file/kvi_fileutils.h index 2e9b5fbd8..f4947656d 100644 --- a/src/kvilib/file/kvi_fileutils.h +++ b/src/kvilib/file/kvi_fileutils.h @@ -28,6 +28,8 @@ * \file kvi_fileutils.h * \author Szymon Stefanek * \brief File utilities functions +* \def KVI_PATH_SEPARATOR Defines the path separator, UNIX or win32 +* \def KVI_PATH_SEPARATOR_CHAR Defines the path separator char, UNIX or win32 */ #include "kvi_settings.h" diff --git a/src/kvilib/irc/kvi_avatar.h b/src/kvilib/irc/kvi_avatar.h index 595859add..f6899e57e 100644 --- a/src/kvilib/irc/kvi_avatar.h +++ b/src/kvilib/irc/kvi_avatar.h @@ -25,132 +25,164 @@ // //============================================================================= +/** +* \file kvi_avatar.h +* \author Szymon Stefanek +* \brief Avatar handling +*/ + #include "kvi_heapobject.h" #include "kvi_settings.h" - #include "kvi_animatedpixmap.h" #include <QPixmap> #include <QHash> -inline uint qHash(const QSize& s) { return uint(s.width() | s.height()); } +/** +* \brief Returns an hash based on avatar dimensions +* \param s +* \return uint +*/ +inline uint qHash(const QSize & s) { return uint(s.width() | s.height()); } +/** +* \class KviAvatar +* \brief Avatar class +*/ class KVILIB_API KviAvatar : public KviHeapObject { public: - KviAvatar(const QString &szLocalPath, - const QString &szName, - const QSize& scaleOnLoad = QSize()); - ~KviAvatar(); + /** + * \brief Constructs the avatar object + * \param szLocalPath The local path of the avatar + * \param szName The name of the avatar + * \param scaleOnLoad If we want to scale the avatar on load + * \return KviAvatar + */ + KviAvatar(const QString & szLocalPath, + const QString & szName, + const QSize & scaleOnLoad = QSize()); + /** + * \brief Destroys the avatar object + */ + ~KviAvatar(); private: QString m_szLocalPath; QString m_szName; bool m_bRemote; KviAnimatedPixmap * m_pPixmap; - QHash<QSize,KviAnimatedPixmap*> m_scaledPixmapsCache; + QHash<QSize,KviAnimatedPixmap *> m_scaledPixmapsCache; public: - - /* - * Returns true, if avatar is remote. - */ + /** + * \brief Returns true, if avatar is remote. + * \return bool + */ inline bool isRemote() { return m_bRemote; } - /* - * Returns filepath - */ - inline const QString &localPath() { + /** + * \brief Returns filepath + * \return const QString & + */ + inline const QString & localPath() { return m_szLocalPath; } - /* - * Returns fiename. For remote avatars, remote address will be returned. - */ - inline const QString &name() { + /** + * \brief Returns fiename. + * For remote avatars, remote address will be returned. + * \return const QString & + */ + inline const QString & name() { return m_szName; } - /* - * Returns true, if underlying pixmap contains more, then one frame. - */ + /** + * \brief Returns true, if underlying pixmap contains more then one frame. + * \return bool + */ inline bool isAnimated() { return (m_pPixmap->framesCount() > 1); } - /* - * Returns original pixmap's size - */ - inline const QSize& size() { + /** + * \brief Returns original pixmap's size + * \return const QSize & + */ + inline const QSize & size() { return m_pPixmap->size(); } - /* - * Returns unscaled original frame. - */ - inline QPixmap* pixmap() { + /** + * \brief Returns unscaled original frame. + * \return QPixmap * + */ + inline QPixmap * pixmap() { return m_pPixmap->pixmap(); } - /* - * Returns true if pixmap has at least one loaded frame. - * Returns false otherways. - */ + /** + * \brief Returns true if pixmap has at least one loaded frame. + * Returns false otherwise. + * \return bool + */ inline bool isValid() { return m_pPixmap->isValid(); } - /* - * Returns original animated pixmap. - */ + /** + * \brief Returns original animated pixmap. + * \return KviAnimatedPixmap * + */ inline KviAnimatedPixmap * animatedPixmap() { return m_pPixmap; } - /* - * Returns animated pixmap, scaled to the requisted size. - * Scaling automagically keeps aspect ratio. - * Scaled image cached. - * - * KviAvatar takes ownership on it, and will automatically delete it - * in destructor. - * - * It is safe to connect returned KviAnimatedPixmap signals to external - * slots. - */ + /** + * \brief Returns animated pixmap, scaled to the requisted size. + * Scaling automagically keeps aspect ratio. + * Scaled image cached. + * + * KviAvatar takes ownership on it, and will automatically delete it + * in destructor. + * + * It is safe to connect returned KviAnimatedPixmap signals to external + * slots. + * \param size The size of the avatar + * \return KviAnimatedPixmap * + */ + KviAnimatedPixmap * forSize(const QSize & size); - KviAnimatedPixmap * forSize(const QSize& size); + /** + * \brief Returns animated pixmap, scaled to the requisted size. + * Scaling automagically keeps aspect ratio. + * Scaled image cached. + * + * KviAvatar takes ownership on it, and will automatically delete it + * in destructor. + * + * It is safe to connect returned KviAnimatedPixmap signals to external + * slots. + * \param w The width of the avatar + * \param h The height of the avatar + * \return KviAnimatedPixmap * + */ inline KviAnimatedPixmap * forSize(unsigned int w, unsigned int h) { return forSize(QSize(w,h)); } - // string that uniquely identifies this avatar - // for remote avatars that have name starting with http:// - // the name is used. - // for local avatars the localPath is used instead - const QString &identificationString(){ return m_bRemote ? m_szName : m_szLocalPath; }; - - - // if name is http://xxxx - // then identification is the name - // if name is xxx.png - // then identification is the local path - - - // name : visible name of the avatar : url or filename - // ex: http://www.kvirc.net/img/pragma.png - // ex: pragma.png - // local path : local path - // ex: /home/pragma/.kvirc/avatars/http.www.kvirc.net.img.pragma.png - // ex: /home/pragma/.kvirc/avatars/pragma.png - - // local path->name : strip leading path informations - // name->local path : replace : / and - + /** + * \brief Returns the string that uniquely identifies this avatar. + * For remote avatars that have name starting with http:// the name is used. + * For local avatars the localPath is used instead + * \return const QString & + */ + const QString & identificationString(){ return m_bRemote ? m_szName : m_szLocalPath; }; }; #endif //_KVI_AVATAR_H_ diff --git a/src/kvilib/irc/kvi_avatarcache.h b/src/kvilib/irc/kvi_avatarcache.h index 2eb14092e..abdfb03de 100644 --- a/src/kvilib/irc/kvi_avatarcache.h +++ b/src/kvilib/irc/kvi_avatarcache.h @@ -24,46 +24,113 @@ // //============================================================================= +/** +* \file kvi_avatarcache.h +* \author Szymon Stefanek +* \brief Avatar cache handling +*/ + #include "kvi_settings.h" #include "kvi_qstring.h" #include "kvi_time.h" #include "kvi_ircmask.h" - #include "kvi_pointerhashtable.h" - +/** +* \typedef KviAvatarCacheEntry +* \struct _KviAvatarCacheEntry +* \brief Defines a struct for the avatar entry in the cache +*/ typedef struct _KviAvatarCacheEntry { - QString szIdString; - kvi_time_t tLastAccess; + QString szIdString; /**< The id of the avatar */ + kvi_time_t tLastAccess; /**< The time the avatar was last accessed */ } KviAvatarCacheEntry; - - +/** +* \class KviAvatarCache +* \brief Avatar cache handling class +*/ class KVILIB_API KviAvatarCache { protected: + /** + * \brief Constructs the avatar cache object + * \return KviAvatarCache + */ KviAvatarCache(); + + /** + * \brief Destroys the avatar cache object + */ ~KviAvatarCache(); public: KviPointerHashTable<QString,KviAvatarCacheEntry> * m_pAvatarDict; protected: static KviAvatarCache * m_pAvatarCacheInstance; public: + /** + * \brief Initializes the avatar cache + * \return void + */ static void init(); + + /** + * \brief Destroys the avatar cache + * \return void + */ static void done(); + /** + * \brief Returns the instance of the avatar cache + * \return KviAvatarCache * + */ static KviAvatarCache * instance(){ return m_pAvatarCacheInstance; }; - void replace(const QString &szIdString,const KviIrcMask &mask,const QString &szNetwork); - void remove(const KviIrcMask &mask,const QString &szNetwork); - const QString & lookup(const KviIrcMask &mask,const QString &szNetwork); + /** + * \brief Replaces a cached avatar + * \param szIdString The id of the avatar + * \param mask The mask of the user + * \param szNetwork The network where the user is on + * \return void + */ + void replace(const QString & szIdString, const KviIrcMask & mask, const QString & szNetwork); + + /** + * \brief Remove an avatar from the cache + * \param mask The mask of the user + * \param szNetwork The network where the user is on + * \return void + */ + void remove(const KviIrcMask & mask, const QString & szNetwork); + + /** + * \brief Search an user in the cache and returns the id of the avatar + * \param mask The mask of the user + * \param szNetwork The network where the user is on + * \return const QString & + */ + const QString & lookup(const KviIrcMask & mask, const QString & szNetwork); + /** + * \brief Deletes the cache + * \return void + */ void cleanup(); - void load(const QString &szFileName); - void save(const QString &szFileName); -}; + /** + * \brief Loads the cache + * \param szFileName The cache filename + * \return void + */ + void load(const QString & szFileName); + /** + * \brief Saves the cache + * \param szFileName The cache filename + * \return void + */ + void save(const QString & szFileName); +}; -#endif //!_KVI_AVATARCACHE_H_ +#endif //_KVI_AVATARCACHE_H_ diff --git a/src/kvilib/irc/kvi_ircmask.cpp b/src/kvilib/irc/kvi_ircmask.cpp index 68cb88e61..d5e2f5ae4 100644 --- a/src/kvilib/irc/kvi_ircmask.cpp +++ b/src/kvilib/irc/kvi_ircmask.cpp @@ -657,7 +657,6 @@ QString KviIrcMask::getHostDomainMask() const return ret; } - QString KviIrcMask::getLargeHostDomainMask() const { int len = m_szHost.length(); @@ -683,7 +682,6 @@ QString KviIrcMask::getLargeHostDomainMask() const return ret; } -// this is just a GUESS and must be called AFTER making sure that it is NOT a plain numeric IP bool KviIrcMask::hasMaskedIp() const { int len = m_szHost.length(); @@ -698,7 +696,6 @@ bool KviIrcMask::hasMaskedIp() const return ((e - p) > 4); // at the moment 4 should be enough : the largest top part is "name" } - bool KviIrcMask::operator==(const KviIrcMask &user) { if(KviQString::equalCI(m_szNick,user.m_szNick)) @@ -744,7 +741,6 @@ int KviIrcMask::nonWildChars() aux++; } - aux = KviQString::nullTerminatedArray(m_szHost); while((uc = aux->unicode())) { diff --git a/src/kvilib/irc/kvi_ircmask.h b/src/kvilib/irc/kvi_ircmask.h index cd4693a39..20d264b15 100644 --- a/src/kvilib/irc/kvi_ircmask.h +++ b/src/kvilib/irc/kvi_ircmask.h @@ -24,18 +24,24 @@ // Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //============================================================================= - // originally this file was named kvi_ircuser.h and the class was KviIrcUser // ported to UNICODE on 2004.10.28 1:50 am +//============================================================================= + +/** +* \file kvi_ircmask.h +* \author Szymon Stefanek +* \brief Irc user mask abstraction +*/ #include "kvi_settings.h" #include "kvi_heapobject.h" #include "kvi_qstring.h" -//============================================================================= -// Irc user mask abstraction -//============================================================================= - +/** +* \class KviIrcMask +* \brief Irc user mask handling +*/ class KVILIB_API KviIrcMask : public KviHeapObject { friend class KviIrcUserList; @@ -46,113 +52,251 @@ private: QString m_szHost; static QString m_szWild; public: - // Sets the nick for this user.<br> - // If szNick is NULL or it points to an empty string the nick is set to "*".<br> - void setNick(const QString &szNick){ m_szNick = szNick.isEmpty() ? m_szWild : szNick; }; - // Sets the username for this user.<br> - // If szUsername is NULL or it points to an empty string the username is set to "*".<br> - void setUsername(const QString &szUser){ m_szUser = szUser.isEmpty() ? m_szWild : szUser; }; + /** + * \enum MaskType + */ + enum MaskType + { + NickUserHost = 0, /**< nick!~user@machine.host.top (default) */ + NickUserNet = 1, /**< 1 : nick!~user@*.abc.host.top */ + NickUser = 2, /**< 2 : nick!~user@* */ + NickHost = 3, /**< 3 : nick!*@machine.host.top */ + NickNet = 4, /**< 4 : nick!*@*.abc.host.top */ + Nick = 5, /**< 5 : nick!*@* */ + UserHost = 6, /**< 6 : *!~user@machine.host.top */ + UserNet = 7, /**< 7 : *!~user@*.abc.host.top */ + User = 8, /**< 8 : *!~user@* */ + Host = 9, /**< 9 : *!*@machine.host.top */ + Net = 10, /**< 10 : *!*@*.abc.host.top */ + NickCleanUserHost = 11, /**< 11 : nick!*user@machine.host.top */ + NickCleanUserNet = 12, /**< 12 : nick!*user@*.abc.host.top */ + NickCleanUser = 13, /**< 13 : nick!*user@* */ + CleanUserHost = 14, /**< 14 : *!*user@machine.host.top */ + CleanUserNet = 15, /**< 15 : *!*user@*.abc.host.top */ + CleanUser = 16, /**< 16 : *!*user@* */ + NickUserLargeNet = 17, /**< 17 : nick!~user@*.host.top */ + NickLargeNet = 18, /**< 18 : nick!*@*.host.top */ + UserLargeNet = 19, /**< 19 : *!~user@*.host.top */ + NickCleanUserLargeNet = 20, /**< 20 : nick!*user@*.host.top */ + CleanUserLargeNet = 21, /**< 21 : *!*user@*.host.top */ + NickUserSmartNet = 22, /**< 22 : nick!~user@*.host.top */ + NickSmartNet = 23, /**< 23 : nick!*@*.host.top */ + UserSmartNet = 24, /**< 24 : *!~user@*.host.top */ + NickCleanUserSmartNet = 25, /**< 25 : nick!*user@*.host.top */ + CleanUserSmartNet = 26 /**< 26 : *!*user@*.host.top */ + }; + + /** + * \brief Constructs an empty mask (*!*@*) + * \return KviIrcMask + */ + KviIrcMask(); + + /** + * \brief Constructs this KviIrcMask object from a string mask + * \param szMask The mask of the user + * \return KviIrcMask + */ + KviIrcMask(const QString & szMask); + + /** + * \brief Carbon copy + * \param ircUser The mask of the user + * \return KviIrcMask + */ + KviIrcMask(const KviIrcMask & ircUser) + : m_szNick(ircUser.m_szNick), m_szUser(ircUser.m_szUser), m_szHost(ircUser.m_szHost) {}; + + /** + * \brief Carbon copy + * \param nick The nickname of the user + * \param user The username of the user + * \param host The hostname of the user + * \return KviIrcMask + */ + KviIrcMask(const QString & nick, const QString & user, const QString & host) + : m_szNick(nick), m_szUser(user), m_szHost(host) {}; + + /** + * \brief Sets the nick for this user. + * If szNick is NULL or it points to an empty string the nick is set to "*". + * \param szNick The nickname of the user + * \return void + */ + void setNick(const QString & szNick){ m_szNick = szNick.isEmpty() ? m_szWild : szNick; }; + + /** + * \brief Sets the username for this user. + * If szUsername is NULL or it points to an empty string the username is set to "*". + * \param szUser The username of the user + * \return void + */ + void setUsername(const QString & szUser){ m_szUser = szUser.isEmpty() ? m_szWild : szUser; }; + + /** + * \brief Sets the username for this user. + * If szUsername is NULL or it points to an empty string the username is set to "*". + * This is an alias of setUsername() + * \param szUser The username of the user + * \return void + */ void setUser(const QString &szUser){ m_szUser = szUser.isEmpty() ? m_szWild : szUser; }; - // Sets the host for this user.<br> - // If szHost is NULL or it points to an empty string the host is set to "*".<br> + + /** + * \brief Sets the host for this user. + * If szHost is NULL or it points to an empty string the host is set to "*". + * \param szHost The hostname of the user + * \return void + */ void setHost(const QString &szHost){ m_szHost = szHost.isEmpty() ? m_szWild : szHost; }; - // Sets the host , nick and username extracting it from an irc mask:<br> - // nick!user@host<br> - // The mask is terminated by end-of string null character or a character equal to c in the string.<br> - // Returns the pointer to the end of the mask in the szMask string.(c or null-terminator)<br> + + // Sets the host , nick and username extracting it from an irc mask: + // nick!user@host + // The mask is terminated by end-of string null character or a character equal to c in the string. + // Returns the pointer to the end of the mask in the szMask string.(c or null-terminator) //const char * setMask(const QString &szMask,char c=' '); - // Sets the host , nick and username extracting it from an userhost mask:<br> - // nick[*]=<+|->user@host<br> - // The mask is terminated by end-of string null char or a space character.<br> - // Returns the pointer to the next non-space char in the szMask string or to the null-terminator<br> + + // Sets the host , nick and username extracting it from an userhost mask: + // nick[*]=<+|->user@host + // The mask is terminated by end-of string null char or a space character. + // Returns the pointer to the next non-space char in the szMask string or to the null-terminator // If there are no more masks avaiable. // WARNING : the szMask pointer can NOT be NULL //const char *setUserhostMask(const QString &szMask); - // Returns the nick of this user.<br> - // In the worst case you get a string == "*"<br> - const QString &nick() const { return m_szNick; }; - const QString &user() const { return m_szUser; }; - const QString &host() const { return m_szHost; }; + /** + * \brief Returns the nickname of this user. + * In the worst case you get a string == "*" + * \return const QString & + */ + const QString & nick() const { return m_szNick; }; + + /** + * \brief Returns the username of this user. + * In the worst case you get a string == "*" + * \return const QString & + */ + const QString & user() const { return m_szUser; }; + + /** + * \brief Returns the hostname of this user. + * In the worst case you get a string == "*" + * \return const QString & + */ + const QString & host() const { return m_szHost; }; + + /** + * \brief Returns true if the username is set in the mask + * \return bool + */ bool hasUser() const { return !(m_szUser.isEmpty() || (m_szUser == m_szWild)); }; + + /** + * \brief Returns true if the hostname is set in the mask + * \return bool + */ bool hasHost() const { return !(m_szHost.isEmpty() || (m_szHost == m_szWild)); }; + /** + * \brief Returns true if the hostname is a numeric IP + * \return bool + */ bool hasNumericHost() const; - // Retuns in szMask the specified (if possible) mask of this user.<br> - // If the host or username are not known , the mask may contain less information - // than requested.<br> - enum MaskType - { - NickUserHost = 0, // nick!~user@machine.host.top (nick!~user@XXX.XXX.XXX.XXX) (default) - NickUserNet = 1, // 1 : nick!~user@*.abc.host.top (nick!~user@XXX.XXX.XXX.*) - NickUser = 2, // 2 : nick!~user@* - NickHost = 3, // 3 : nick!*@machine.host.top (nick!*@XXX.XXX.XXX.XXX) - NickNet = 4, // 4 : nick!*@*.abc.host.top (nick!*@XXX.XXX.XXX.*) - Nick = 5, // 5 : nick!*@* - UserHost = 6, // 6 : *!~user@machine.host.top (*!~user@XXX.XXX.XXX.XXX) - UserNet = 7, // 7 : *!~user@*.abc.host.top (*!~user@XXX.XXX.XXX.*) - User = 8, // 8 : *!~user@* - Host = 9, // 9 : *!*@machine.host.top (*!*@XXX.XXX.XXX.XXX) - Net = 10, // 10: *!*@*.abc.host.top (*!*@XXX.XXX.XXX.*) - NickCleanUserHost = 11, // 11 : nick!*user@machine.host.top (nick!*user@XXX.XXX.XXX.XXX) - NickCleanUserNet = 12, // 12 : nick!*user@*.abc.host.top (nick!*user@XXX.XXX.XXX.*) - NickCleanUser = 13, // 13 : nick!*user@* - CleanUserHost = 14, // 14 : *!*user@machine.host.top (*!user@*XXX.XXX.XXX.XXX) - CleanUserNet = 15, // 15 : *!*user@*.abc.host.top (*!user@*XXX.XXX.XXX.*) - CleanUser = 16, // 16 : *!*user@* - NickUserLargeNet = 17, // 17 : nick!~user@*.host.top (nick!~user@XXX.XXX.*) - NickLargeNet = 18, // 18 : nick!*@*.host.top (nick!*@XXX.XXX.*) - UserLargeNet = 19, // 19 : *!~user@*.host.top (*!~user@XXX.XXX.*) - NickCleanUserLargeNet = 20, // 20 : nick!*user@*.host.top (nick!*user@XXX.XXX.*) - CleanUserLargeNet = 21, // 21 : *!*user@*.host.top (*!user@*XXX.XXX.*) - // smart versions of the masks 17-21 that try take care of masked ip addresses - // in the form xxx.xxx.INVALID-TOP-MASK - NickUserSmartNet = 22, // 22 : nick!~user@*.host.top (nick!~user@XXX.XXX.*) - NickSmartNet = 23, // 23 : nick!*@*.host.top (nick!*@XXX.XXX.*) - UserSmartNet = 24, // 24 : *!~user@*.host.top (*!~user@XXX.XXX.*) - NickCleanUserSmartNet = 25, // 25 : nick!*user@*.host.top (nick!*user@XXX.XXX.*) - CleanUserSmartNet = 26 // 26 : *!*user@*.host.top (*!user@*XXX.XXX.*) - }; + /** + * \brief Returns in szMask the specified (if possible) mask of this user. + * If the host or username are not known , the mask may contain less + * information than requested. + * \param szMask The mask of the user + * \param eMaskType The mask type + */ + void mask(QString & szMask, MaskType eMaskType = NickCleanUserHost) const; - void mask(QString &szMask,MaskType eMaskType = NickCleanUserHost) const; + /** + * \brief Returns true if the nickname contains wildcards (* and ?) + * \return bool + */ bool hasWildNick(); - // Wild external matches (this and external are wild) - -// bool matches(const char *szMask); -// // passing 0 as one of params here means that it is a match by default -// bool matches(const char *nick,const char *user,const char *host); - bool matches(const KviIrcMask &mask) const; + /** + * \brief Wild external matches (this and external are wild) + * \param mask The mask of the user + * \return bool + */ + //bool matches(const char *szMask); + // passing 0 as one of params here means that it is a match by default + //bool matches(const char *nick,const char *user,const char *host); + bool matches(const KviIrcMask & mask) const; + /** + * \brief Fixed external matches (this is wild , external is fixed) + * \param nick The nickname of the user + * \param user The username of the user + * \param host The hostname of the user + * \return bool + */ + bool matchesFixed(const QString & nick, const QString & user, const QString & host) const; + //bool matchesFixed(const QString &szMask) const; - // Fixed external matches (this is wild , external is fixed) - bool matchesFixed(const QString &nick,const QString &user,const QString &host) const; -// bool matchesFixed(const QString &szMask) const; - bool matchesFixed(const KviIrcMask &mask) const; + /** + * \brief Fixed external matches (this is wild , external is fixed) + * \param mask The make of the user + * \return bool + */ + bool matchesFixed(const KviIrcMask & mask) const; - // Fixed internal matches (this is fixed , external is wild) + /** + * \brief Fixed internal matches (this is fixed, external is wild) + * \param mask The mask of the user + * \return bool + */ //bool matchedBy(const QString &szMask) const; - bool matchedBy(const KviIrcMask &mask) const { return mask.matchesFixed(*this); }; + bool matchedBy(const KviIrcMask & mask) const { return mask.matchesFixed(*this); }; + /** + * \brief Returns the number of non-wildcards characters in the mask + * \return int + */ int nonWildChars(); - bool operator==(const KviIrcMask &user); -public: - // Constructs an empty mask (*!*@*) - KviIrcMask(); - // Constructs this KviIrcMask object from a string mask - KviIrcMask(const QString &szMask); - // Carbon copy - KviIrcMask(const KviIrcMask &ircUser) - : m_szNick(ircUser.m_szNick), m_szUser(ircUser.m_szUser), m_szHost(ircUser.m_szHost) {}; - KviIrcMask(const QString &nick,const QString &user,const QString &host) - : m_szNick(nick), m_szUser(user), m_szHost(host) {}; + + /** + * \brief Carbon copy + * \param user The username of the user + * \return bool + */ + bool operator==(const KviIrcMask & user); private: + /** + * \brief Returns the number of characters which are parts of the IP + * The IP is in the form xxx.xxx.xxx.* + * \return int + */ int getIpDomainMaskLen() const; - QString getHostDomainMask() const; + + /** + * \brief Returns the number of characters which are parts of the IP + * The IP is in the form xxx.xxx.* + * \return int + */ int getLargeIpDomainMaskLen() const; + + /** + * \brief Returns the ip in the form xxx.xxx.xxx.* + * \return QString + */ + QString getHostDomainMask() const; + + /** + * \brief Returns the ip in the form xxx.xxx.* + * \return QString + */ QString getLargeHostDomainMask() const; - // this is just a GUESS and must be called AFTER making sure that it is NOT a plain numeric IP + + /** + * \brief + * \return bool + * \warning This is just a GUESS and must be called AFTER making sure that it is NOT a plain numeric IP + */ bool hasMaskedIp() const; }; diff --git a/src/kvilib/system/kvi_env.cpp b/src/kvilib/system/kvi_env.cpp index a893a9ad7..3213e3753 100644 --- a/src/kvilib/system/kvi_env.cpp +++ b/src/kvilib/system/kvi_env.cpp @@ -85,4 +85,4 @@ void kvi_unsetenv(const char * name) #endif } -#endif //!COMPILE_ON_WINDOWS +#endif //COMPILE_ON_WINDOWS diff --git a/src/kvilib/system/kvi_env.h b/src/kvilib/system/kvi_env.h index 40c2784b2..7b3d544c6 100644 --- a/src/kvilib/system/kvi_env.h +++ b/src/kvilib/system/kvi_env.h @@ -25,16 +25,23 @@ // //============================================================================= -//============================================================================= -// Environment function wrappers -//============================================================================= +/** +* \file kvi_env.h +* \author Szymon Stefanek +* \brief Environment function wrappers +* \def kvi_setenv(__name,__value) Defines kvi_setenv(__name,__value) as SetEnvironmentVariable(__name,__value) on win32 +* \def kvi_unsetenv(__name) Defines kvi_unsetenv(__name) as SetEnvironmentVariable(__name,NULL) on win32 +*/ #include "kvi_settings.h" - - #include <stdlib.h> +/** +* \brief Gets environment variable +* \param name The name of the variable to get +* \return char * +*/ inline char * kvi_getenv(const char * name) { return getenv(name); @@ -45,12 +52,22 @@ inline char * kvi_getenv(const char * name) #define kvi_unsetenv(__name) SetEnvironmentVariable(__name,NULL) #else #ifndef _KVI_ENV_CPP_ - KVILIB_API extern bool kvi_setenv(const char * name,const char * value); + /** + * \brief Sets environment variable + * \param name The name of the variable to set + * \param value The value of the variable + * \return bool + */ + KVILIB_API extern bool kvi_setenv(const char * name, const char * value); + + /** + * \brief Unsets environment variable + * \param name The name of the variable to set + * \return void + */ KVILIB_API extern void kvi_unsetenv(const char * name); #endif #endif - - #endif //_KVI_ENV_H_ diff --git a/src/kvilib/system/kvi_process.h b/src/kvilib/system/kvi_process.h index c47fcf398..24b30a1f0 100644 --- a/src/kvilib/system/kvi_process.h +++ b/src/kvilib/system/kvi_process.h @@ -24,9 +24,15 @@ // //============================================================================= +/** +* \file kvi_process.h +* \author Szymon Stefanek +* \brief A simple name redefinition +* \def KviProcess Defines KviProcess as QProcess +*/ #include "kvi_settings.h" #include <QProcess> #define KviProcess QProcess -#endif //!_KVI_PROCESS_H_ +#endif //_KVI_PROCESS_H_ |
