Fix spacing in c++ files
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* oocontext.cpp
|
||||
** 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
|
||||
** or implied.
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "strophe.h"
|
||||
#include "strophepp.h"
|
||||
|
||||
XMPP::Context::Context()
|
||||
XMPP::Context::Context()
|
||||
{
|
||||
m_mem.alloc = callAlloc;
|
||||
m_mem.realloc = callRealloc;
|
||||
@@ -48,8 +48,8 @@ void XMPP::Context::free(void *p)
|
||||
}
|
||||
|
||||
void XMPP::Context::log(const xmpp_log_level_t level,
|
||||
const char * const area,
|
||||
const char * const msg)
|
||||
const char * const area,
|
||||
const char * const msg)
|
||||
{
|
||||
/* 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 * const userdata)
|
||||
void * const userdata)
|
||||
{
|
||||
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,
|
||||
const xmpp_log_level_t level,
|
||||
const char * const area,
|
||||
const char * const msg)
|
||||
const xmpp_log_level_t level,
|
||||
const char * const area,
|
||||
const char * const msg)
|
||||
{
|
||||
reinterpret_cast<Context *>(userdata)->log(level, area, msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* oostanza.cpp
|
||||
** 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
|
||||
** or implied.
|
||||
@@ -28,8 +28,8 @@ void *Stanza::operator new(size_t size, Context *ctx)
|
||||
if (!p) return p;
|
||||
|
||||
*reinterpret_cast<Context **>(p) = ctx;
|
||||
p = reinterpret_cast<void *>(reinterpret_cast<char *>(p) +
|
||||
sizeof(Context *));
|
||||
p = reinterpret_cast<void *>(reinterpret_cast<char *>(p) +
|
||||
sizeof(Context *));
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ Stanza *Stanza::create(Context *ctx)
|
||||
void Stanza::release()
|
||||
{
|
||||
if (::xmpp_stanza_release(m_stanza))
|
||||
delete this;
|
||||
delete this;
|
||||
}
|
||||
|
||||
Stanza *Stanza::clone()
|
||||
@@ -75,5 +75,3 @@ Stanza *Stanza::copy()
|
||||
// TODO
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
168
strophepp.h
168
strophepp.h
@@ -5,7 +5,7 @@
|
||||
**
|
||||
** This software is provided AS-IS with no warranty, either express or
|
||||
** implied.
|
||||
**
|
||||
**
|
||||
** This program is dual licensed under the MIT and GPLv3 licenses.
|
||||
*/
|
||||
|
||||
@@ -21,112 +21,112 @@
|
||||
namespace XMPP {
|
||||
class Context {
|
||||
private:
|
||||
xmpp_mem_t m_mem;
|
||||
xmpp_log_t m_log;
|
||||
xmpp_ctx_t *m_ctx;
|
||||
xmpp_mem_t m_mem;
|
||||
xmpp_log_t m_log;
|
||||
xmpp_ctx_t *m_ctx;
|
||||
|
||||
public:
|
||||
Context();
|
||||
virtual ~Context();
|
||||
Context();
|
||||
virtual ~Context();
|
||||
|
||||
virtual void *alloc(const size_t size);
|
||||
virtual void *realloc(void *p, const size_t size);
|
||||
virtual void free(void *p);
|
||||
virtual void log(const xmpp_log_level_t level,
|
||||
const char * const area,
|
||||
const char * const msg);
|
||||
virtual void *alloc(const size_t size);
|
||||
virtual void *realloc(void *p, const size_t size);
|
||||
virtual void free(void *p);
|
||||
virtual void log(const xmpp_log_level_t level,
|
||||
const char * const area,
|
||||
const char * const msg);
|
||||
|
||||
xmpp_ctx_t *getContext();
|
||||
xmpp_ctx_t *getContext();
|
||||
|
||||
private:
|
||||
static void *callAlloc(const size_t size, void * const userdata);
|
||||
static void *callRealloc(void *p, const size_t size,
|
||||
void * const userdata);
|
||||
static void callFree(void *p, void * const userdata);
|
||||
static void callLog(void * const userdata,
|
||||
const xmpp_log_level_t level,
|
||||
const char * const area,
|
||||
const char * const msg);
|
||||
static void *callAlloc(const size_t size, void * const userdata);
|
||||
static void *callRealloc(void *p, const size_t size,
|
||||
void * const userdata);
|
||||
static void callFree(void *p, void * const userdata);
|
||||
static void callLog(void * const userdata,
|
||||
const xmpp_log_level_t level,
|
||||
const char * const area,
|
||||
const char * const msg);
|
||||
};
|
||||
|
||||
class Stanza {
|
||||
private:
|
||||
Context *m_ctx;
|
||||
xmpp_stanza_t *m_stanza;
|
||||
Context *m_ctx;
|
||||
xmpp_stanza_t *m_stanza;
|
||||
|
||||
void *operator new(size_t size, Context *ctx);
|
||||
void operator delete(void *p);
|
||||
Stanza(Context *ctx);
|
||||
virtual ~Stanza();
|
||||
void *operator new(size_t size, Context *ctx);
|
||||
void operator delete(void *p);
|
||||
Stanza(Context *ctx);
|
||||
virtual ~Stanza();
|
||||
|
||||
public:
|
||||
static Stanza *create(Context *ctx);
|
||||
void release();
|
||||
Stanza *clone();
|
||||
Stanza *copy();
|
||||
|
||||
int toText(const char ** const buf, size_t * const buflen);
|
||||
Stanza *getChildren();
|
||||
Stanza *getChildByName(const char * const name);
|
||||
Stanza *getNext();
|
||||
static Stanza *create(Context *ctx);
|
||||
void release();
|
||||
Stanza *clone();
|
||||
Stanza *copy();
|
||||
|
||||
int toText(const char ** const buf, size_t * const buflen);
|
||||
Stanza *getChildren();
|
||||
Stanza *getChildByName(const char * const name);
|
||||
Stanza *getNext();
|
||||
char *getAttribute(const char * const name);
|
||||
char *getNamespace();
|
||||
char *getText();
|
||||
char *getName();
|
||||
void addChild(Stanza *child);
|
||||
void setNamespace(const char * const ns);
|
||||
void setAttribute(const char * const key, const char * const value);
|
||||
void setName(const char * const name);
|
||||
void setText(const char * const text);
|
||||
void setText(const char * const text, const size_t size);
|
||||
char *getType();
|
||||
char *getId();
|
||||
char *getTo();
|
||||
char *getFrom();
|
||||
void setType(const char * const type);
|
||||
void setId(const char * const id);
|
||||
void setTo(const char * const to);
|
||||
void setFrom(const char * const from);
|
||||
char *getNamespace();
|
||||
char *getText();
|
||||
char *getName();
|
||||
void addChild(Stanza *child);
|
||||
void setNamespace(const char * const ns);
|
||||
void setAttribute(const char * const key, const char * const value);
|
||||
void setName(const char * const name);
|
||||
void setText(const char * const text);
|
||||
void setText(const char * const text, const size_t size);
|
||||
char *getType();
|
||||
char *getId();
|
||||
char *getTo();
|
||||
char *getFrom();
|
||||
void setType(const char * const type);
|
||||
void setId(const char * const id);
|
||||
void setTo(const char * const to);
|
||||
void setFrom(const char * const from);
|
||||
};
|
||||
|
||||
class Connection {
|
||||
private:
|
||||
Context *m_ctx;
|
||||
xmpp_conn_t *conn;
|
||||
Context *m_ctx;
|
||||
xmpp_conn_t *conn;
|
||||
|
||||
void *operator new(size_t size, Context *ctx);
|
||||
Connection(Context *ctx);
|
||||
void *operator new(size_t size, Context *ctx);
|
||||
Connection(Context *ctx);
|
||||
|
||||
public:
|
||||
static Connection *create(Context *ctx);
|
||||
virtual ~Connection();
|
||||
Connection *clone();
|
||||
void operator delete(void *p);
|
||||
static Connection *create(Context *ctx);
|
||||
virtual ~Connection();
|
||||
Connection *clone();
|
||||
void operator delete(void *p);
|
||||
|
||||
const char *getJID();
|
||||
void setJID(const char * const jid);
|
||||
const char *getPass();
|
||||
void setPass(const char * const pass);
|
||||
bool connectClient(const char * const domain,
|
||||
xmpp_conn_handler callback,
|
||||
void * const userdata);
|
||||
void disconnect();
|
||||
void send(Stanza *stanza);
|
||||
const char *getJID();
|
||||
void setJID(const char * const jid);
|
||||
const char *getPass();
|
||||
void setPass(const char * const pass);
|
||||
bool connectClient(const char * const domain,
|
||||
xmpp_conn_handler callback,
|
||||
void * const userdata);
|
||||
void disconnect();
|
||||
void send(Stanza *stanza);
|
||||
|
||||
void addTimedHandler(xmpp_timed_handler handler,
|
||||
const unsigned long perdio,
|
||||
void * const userdata);
|
||||
void deleteTimedHandler(xmpp_timed_handler handler);
|
||||
void addHandler(xmpp_handler handler,
|
||||
const char * const ns,
|
||||
const char * const name,
|
||||
const char * const type,
|
||||
void * const userdata);
|
||||
void deleteHandler(xmpp_handler handler);
|
||||
void addIdHandler(xmpp_handler handler,
|
||||
const char * const id,
|
||||
void * const userdata);
|
||||
void deleteIdHandler(xmpp_handler handler);
|
||||
void addTimedHandler(xmpp_timed_handler handler,
|
||||
const unsigned long perdio,
|
||||
void * const userdata);
|
||||
void deleteTimedHandler(xmpp_timed_handler handler);
|
||||
void addHandler(xmpp_handler handler,
|
||||
const char * const ns,
|
||||
const char * const name,
|
||||
const char * const type,
|
||||
void * const userdata);
|
||||
void deleteHandler(xmpp_handler handler);
|
||||
void addIdHandler(xmpp_handler handler,
|
||||
const char * const id,
|
||||
void * const userdata);
|
||||
void deleteIdHandler(xmpp_handler handler);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user