Fix spacing in c++ files

This commit is contained in:
Dmitry Podgorny
2016-09-27 15:23:16 +03:00
parent d2c1daf4d5
commit 1092447edf
3 changed files with 98 additions and 101 deletions

View File

@@ -1,7 +1,7 @@
/* oocontext.cpp /* oocontext.cpp
** strophe XMPP client library -- C++ context implementation ** strophe XMPP client library -- C++ context implementation
** **
** Copyright (C) 2005-2009 Collecta, Inc. ** Copyright (C) 2005-2009 Collecta, Inc.
** **
** This software is provided AS-IS with no warranty, either express ** This software is provided AS-IS with no warranty, either express
** or implied. ** or implied.
@@ -14,7 +14,7 @@
#include "strophe.h" #include "strophe.h"
#include "strophepp.h" #include "strophepp.h"
XMPP::Context::Context() XMPP::Context::Context()
{ {
m_mem.alloc = callAlloc; m_mem.alloc = callAlloc;
m_mem.realloc = callRealloc; m_mem.realloc = callRealloc;
@@ -48,8 +48,8 @@ void XMPP::Context::free(void *p)
} }
void XMPP::Context::log(const xmpp_log_level_t level, void XMPP::Context::log(const xmpp_log_level_t level,
const char * const area, const char * const area,
const char * const msg) const char * const msg)
{ {
/* do nothing by default */ /* do nothing by default */
} }
@@ -65,7 +65,7 @@ void *XMPP::Context::callAlloc(const size_t size, void * const userdata)
} }
void *XMPP::Context::callRealloc(void *p, const size_t size, void *XMPP::Context::callRealloc(void *p, const size_t size,
void * const userdata) void * const userdata)
{ {
return reinterpret_cast<Context *>(userdata)->realloc(p, size); return reinterpret_cast<Context *>(userdata)->realloc(p, size);
} }
@@ -76,10 +76,9 @@ void XMPP::Context::callFree(void *p, void * const userdata)
} }
void XMPP::Context::callLog(void * const userdata, void XMPP::Context::callLog(void * const userdata,
const xmpp_log_level_t level, const xmpp_log_level_t level,
const char * const area, const char * const area,
const char * const msg) const char * const msg)
{ {
reinterpret_cast<Context *>(userdata)->log(level, area, msg); reinterpret_cast<Context *>(userdata)->log(level, area, msg);
} }

View File

@@ -1,7 +1,7 @@
/* oostanza.cpp /* oostanza.cpp
** strophe XMPP client library -- C++ context implementation ** strophe XMPP client library -- C++ context implementation
** **
** Copyright (C) 2005-2009 Collecta, Inc. ** Copyright (C) 2005-2009 Collecta, Inc.
** **
** This software is provided AS-IS with no warranty, either express ** This software is provided AS-IS with no warranty, either express
** or implied. ** or implied.
@@ -28,8 +28,8 @@ void *Stanza::operator new(size_t size, Context *ctx)
if (!p) return p; if (!p) return p;
*reinterpret_cast<Context **>(p) = ctx; *reinterpret_cast<Context **>(p) = ctx;
p = reinterpret_cast<void *>(reinterpret_cast<char *>(p) + p = reinterpret_cast<void *>(reinterpret_cast<char *>(p) +
sizeof(Context *)); sizeof(Context *));
return p; return p;
} }
@@ -61,7 +61,7 @@ Stanza *Stanza::create(Context *ctx)
void Stanza::release() void Stanza::release()
{ {
if (::xmpp_stanza_release(m_stanza)) if (::xmpp_stanza_release(m_stanza))
delete this; delete this;
} }
Stanza *Stanza::clone() Stanza *Stanza::clone()
@@ -75,5 +75,3 @@ Stanza *Stanza::copy()
// TODO // TODO
return NULL; return NULL;
} }

View File

@@ -5,7 +5,7 @@
** **
** This software is provided AS-IS with no warranty, either express or ** This software is provided AS-IS with no warranty, either express or
** implied. ** implied.
** **
** This program is dual licensed under the MIT and GPLv3 licenses. ** This program is dual licensed under the MIT and GPLv3 licenses.
*/ */
@@ -21,112 +21,112 @@
namespace XMPP { namespace XMPP {
class Context { class Context {
private: private:
xmpp_mem_t m_mem; xmpp_mem_t m_mem;
xmpp_log_t m_log; xmpp_log_t m_log;
xmpp_ctx_t *m_ctx; xmpp_ctx_t *m_ctx;
public: public:
Context(); Context();
virtual ~Context(); virtual ~Context();
virtual void *alloc(const size_t size); virtual void *alloc(const size_t size);
virtual void *realloc(void *p, const size_t size); virtual void *realloc(void *p, const size_t size);
virtual void free(void *p); virtual void free(void *p);
virtual void log(const xmpp_log_level_t level, virtual void log(const xmpp_log_level_t level,
const char * const area, const char * const area,
const char * const msg); const char * const msg);
xmpp_ctx_t *getContext(); xmpp_ctx_t *getContext();
private: private:
static void *callAlloc(const size_t size, void * const userdata); static void *callAlloc(const size_t size, void * const userdata);
static void *callRealloc(void *p, const size_t size, static void *callRealloc(void *p, const size_t size,
void * const userdata); void * const userdata);
static void callFree(void *p, void * const userdata); static void callFree(void *p, void * const userdata);
static void callLog(void * const userdata, static void callLog(void * const userdata,
const xmpp_log_level_t level, const xmpp_log_level_t level,
const char * const area, const char * const area,
const char * const msg); const char * const msg);
}; };
class Stanza { class Stanza {
private: private:
Context *m_ctx; Context *m_ctx;
xmpp_stanza_t *m_stanza; xmpp_stanza_t *m_stanza;
void *operator new(size_t size, Context *ctx); void *operator new(size_t size, Context *ctx);
void operator delete(void *p); void operator delete(void *p);
Stanza(Context *ctx); Stanza(Context *ctx);
virtual ~Stanza(); virtual ~Stanza();
public: public:
static Stanza *create(Context *ctx); static Stanza *create(Context *ctx);
void release(); void release();
Stanza *clone(); Stanza *clone();
Stanza *copy(); Stanza *copy();
int toText(const char ** const buf, size_t * const buflen); int toText(const char ** const buf, size_t * const buflen);
Stanza *getChildren(); Stanza *getChildren();
Stanza *getChildByName(const char * const name); Stanza *getChildByName(const char * const name);
Stanza *getNext(); Stanza *getNext();
char *getAttribute(const char * const name); char *getAttribute(const char * const name);
char *getNamespace(); char *getNamespace();
char *getText(); char *getText();
char *getName(); char *getName();
void addChild(Stanza *child); void addChild(Stanza *child);
void setNamespace(const char * const ns); void setNamespace(const char * const ns);
void setAttribute(const char * const key, const char * const value); void setAttribute(const char * const key, const char * const value);
void setName(const char * const name); void setName(const char * const name);
void setText(const char * const text); void setText(const char * const text);
void setText(const char * const text, const size_t size); void setText(const char * const text, const size_t size);
char *getType(); char *getType();
char *getId(); char *getId();
char *getTo(); char *getTo();
char *getFrom(); char *getFrom();
void setType(const char * const type); void setType(const char * const type);
void setId(const char * const id); void setId(const char * const id);
void setTo(const char * const to); void setTo(const char * const to);
void setFrom(const char * const from); void setFrom(const char * const from);
}; };
class Connection { class Connection {
private: private:
Context *m_ctx; Context *m_ctx;
xmpp_conn_t *conn; xmpp_conn_t *conn;
void *operator new(size_t size, Context *ctx); void *operator new(size_t size, Context *ctx);
Connection(Context *ctx); Connection(Context *ctx);
public: public:
static Connection *create(Context *ctx); static Connection *create(Context *ctx);
virtual ~Connection(); virtual ~Connection();
Connection *clone(); Connection *clone();
void operator delete(void *p); void operator delete(void *p);
const char *getJID(); const char *getJID();
void setJID(const char * const jid); void setJID(const char * const jid);
const char *getPass(); const char *getPass();
void setPass(const char * const pass); void setPass(const char * const pass);
bool connectClient(const char * const domain, bool connectClient(const char * const domain,
xmpp_conn_handler callback, xmpp_conn_handler callback,
void * const userdata); void * const userdata);
void disconnect(); void disconnect();
void send(Stanza *stanza); void send(Stanza *stanza);
void addTimedHandler(xmpp_timed_handler handler, void addTimedHandler(xmpp_timed_handler handler,
const unsigned long perdio, const unsigned long perdio,
void * const userdata); void * const userdata);
void deleteTimedHandler(xmpp_timed_handler handler); void deleteTimedHandler(xmpp_timed_handler handler);
void addHandler(xmpp_handler handler, void addHandler(xmpp_handler handler,
const char * const ns, const char * const ns,
const char * const name, const char * const name,
const char * const type, const char * const type,
void * const userdata); void * const userdata);
void deleteHandler(xmpp_handler handler); void deleteHandler(xmpp_handler handler);
void addIdHandler(xmpp_handler handler, void addIdHandler(xmpp_handler handler,
const char * const id, const char * const id,
void * const userdata); void * const userdata);
void deleteIdHandler(xmpp_handler handler); void deleteIdHandler(xmpp_handler handler);
}; };
} }