Skip to content

Commit

Permalink
Pass clang-format on 14 trivial header files fixes
Browse files Browse the repository at this point in the history
Also remove them from whitelist
  • Loading branch information
nerzhul committed Apr 7, 2017
1 parent 271d7c3 commit 4af99b7
Show file tree
Hide file tree
Showing 15 changed files with 146 additions and 154 deletions.
4 changes: 2 additions & 2 deletions src/script/cpp_api/s_client.h
Expand Up @@ -22,16 +22,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define S_CLIENT_H_

#include "cpp_api/s_base.h"
#include "util/string.h"
#include "mapnode.h"
#include "util/string.h"

#ifdef _CRT_MSVCP_CURRENT
#include <cstdint>
#endif

class ClientEnvironment;

class ScriptApiClient: virtual public ScriptApiBase
class ScriptApiClient : virtual public ScriptApiBase
{
public:
// Calls on_shutdown handlers
Expand Down
14 changes: 6 additions & 8 deletions src/script/cpp_api/s_player.h
Expand Up @@ -26,8 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,

struct ToolCapabilities;

class ScriptApiPlayer
: virtual public ScriptApiBase
class ScriptApiPlayer : virtual public ScriptApiBase
{
public:
virtual ~ScriptApiPlayer();
Expand All @@ -36,17 +35,16 @@ class ScriptApiPlayer
void on_dieplayer(ServerActiveObject *player);
bool on_respawnplayer(ServerActiveObject *player);
bool on_prejoinplayer(const std::string &name, const std::string &ip,
std::string *reason);
std::string *reason);
void on_joinplayer(ServerActiveObject *player);
void on_leaveplayer(ServerActiveObject *player, bool timeout);
void on_cheat(ServerActiveObject *player, const std::string &cheat_type);
bool on_punchplayer(ServerActiveObject *player,
ServerActiveObject *hitter, float time_from_last_punch,
const ToolCapabilities *toolcap, v3f dir, s16 damage);
bool on_punchplayer(ServerActiveObject *player, ServerActiveObject *hitter,
float time_from_last_punch, const ToolCapabilities *toolcap,
v3f dir, s16 damage);
s16 on_player_hpchange(ServerActiveObject *player, s16 hp_change);
void on_playerReceiveFields(ServerActiveObject *player,
const std::string &formname, const StringMap &fields);
const std::string &formname, const StringMap &fields);
};


#endif /* S_PLAYER_H_ */
5 changes: 2 additions & 3 deletions src/script/lua_api/l_areastore.h
Expand Up @@ -22,12 +22,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,

#include "lua_api/l_base.h"


class AreaStore;

class LuaAreaStore : public ModApiBase {
class LuaAreaStore : public ModApiBase
{
private:

static const char className[];
static const luaL_reg methods[];

Expand Down
7 changes: 4 additions & 3 deletions src/script/lua_api/l_metadata.h
Expand Up @@ -19,23 +19,24 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef L_METADATA_H_
#define L_METADATA_H_

#include "lua_api/l_base.h"
#include "irrlichttypes_bloated.h"
#include "lua_api/l_base.h"

class Metadata;

/*
NodeMetaRef
*/

class MetaDataRef : public ModApiBase {
class MetaDataRef : public ModApiBase
{
public:
virtual ~MetaDataRef() {}
protected:
static MetaDataRef *checkobject(lua_State *L, int narg);

virtual void reportMetadataChange() {}
virtual Metadata* getmeta(bool auto_create) = 0;
virtual Metadata *getmeta(bool auto_create) = 0;
virtual void clearMeta() = 0;

virtual void handleToTable(lua_State *L, Metadata *meta);
Expand Down
8 changes: 4 additions & 4 deletions src/script/lua_api/l_minimap.h
Expand Up @@ -22,12 +22,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,

#include "l_base.h"


class Minimap;

class LuaMinimap : public ModApiBase {
class LuaMinimap : public ModApiBase
{
private:

static const char className[];
static const luaL_reg methods[];

Expand All @@ -49,14 +48,15 @@ class LuaMinimap : public ModApiBase {
static int l_toggle_shape(lua_State *L);

Minimap *m_minimap;

public:
LuaMinimap(Minimap *m);
~LuaMinimap() {}

static void create(lua_State *L, Minimap *object);

static LuaMinimap *checkobject(lua_State *L, int narg);
static Minimap* getobject(LuaMinimap *ref);
static Minimap *getobject(LuaMinimap *ref);

static void Register(lua_State *L);
};
Expand Down
7 changes: 3 additions & 4 deletions src/script/lua_api/l_nodetimer.h
Expand Up @@ -20,12 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef L_NODETIMER_H_
#define L_NODETIMER_H_

#include "lua_api/l_base.h"
#include "irr_v3d.h"
#include "lua_api/l_base.h"

class ServerEnvironment;

class NodeTimerRef : public ModApiBase {
class NodeTimerRef : public ModApiBase
{
private:
v3s16 m_p;
ServerEnvironment *m_env;
Expand Down Expand Up @@ -62,6 +63,4 @@ class NodeTimerRef : public ModApiBase {
static void Register(lua_State *L);
};



#endif /* L_NODETIMER_H_ */
27 changes: 14 additions & 13 deletions src/script/lua_api/l_noise.h
Expand Up @@ -20,14 +20,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef L_NOISE_H_
#define L_NOISE_H_

#include "lua_api/l_base.h"
#include "irr_v3d.h"
#include "lua_api/l_base.h"
#include "noise.h"

/*
LuaPerlinNoise
*/
class LuaPerlinNoise : public ModApiBase {
class LuaPerlinNoise : public ModApiBase
{
private:
NoiseParams np;
static const char className[];
Expand Down Expand Up @@ -57,7 +58,8 @@ class LuaPerlinNoise : public ModApiBase {
/*
LuaPerlinNoiseMap
*/
class LuaPerlinNoiseMap : public ModApiBase {
class LuaPerlinNoiseMap : public ModApiBase
{
NoiseParams np;
Noise *noise;
bool m_is3d;
Expand Down Expand Up @@ -95,7 +97,8 @@ class LuaPerlinNoiseMap : public ModApiBase {
/*
LuaPseudoRandom
*/
class LuaPseudoRandom : public ModApiBase {
class LuaPseudoRandom : public ModApiBase
{
private:
PseudoRandom m_pseudo;

Expand All @@ -111,8 +114,7 @@ class LuaPseudoRandom : public ModApiBase {
static int l_next(lua_State *L);

public:
LuaPseudoRandom(s32 seed) :
m_pseudo(seed) {}
LuaPseudoRandom(s32 seed) : m_pseudo(seed) {}

// LuaPseudoRandom(seed)
// Creates an LuaPseudoRandom and leaves it on top of stack
Expand All @@ -126,7 +128,8 @@ class LuaPseudoRandom : public ModApiBase {
/*
LuaPcgRandom
*/
class LuaPcgRandom : public ModApiBase {
class LuaPcgRandom : public ModApiBase
{
private:
PcgRandom m_rnd;

Expand All @@ -146,10 +149,8 @@ class LuaPcgRandom : public ModApiBase {
static int l_rand_normal_dist(lua_State *L);

public:
LuaPcgRandom(u64 seed) :
m_rnd(seed) {}
LuaPcgRandom(u64 seed, u64 seq) :
m_rnd(seed, seq) {}
LuaPcgRandom(u64 seed) : m_rnd(seed) {}
LuaPcgRandom(u64 seed, u64 seq) : m_rnd(seed, seq) {}

// LuaPcgRandom(seed)
// Creates an LuaPcgRandom and leaves it on top of stack
Expand All @@ -160,11 +161,11 @@ class LuaPcgRandom : public ModApiBase {
static void Register(lua_State *L);
};


/*
LuaSecureRandom
*/
class LuaSecureRandom : public ModApiBase {
class LuaSecureRandom : public ModApiBase
{
private:
static const size_t RAND_BUF_SIZE = 2048;
static const char className[];
Expand Down
4 changes: 2 additions & 2 deletions src/script/lua_api/l_server.h
Expand Up @@ -22,7 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,

#include "lua_api/l_base.h"

class ModApiServer : public ModApiBase {
class ModApiServer : public ModApiBase
{
private:
// request_shutdown([message], [reconnect])
static int l_request_shutdown(lua_State *L);
Expand Down Expand Up @@ -107,7 +108,6 @@ class ModApiServer : public ModApiBase {

public:
static void Initialize(lua_State *L, int top);

};

#endif /* L_SERVER_H_ */
30 changes: 15 additions & 15 deletions src/script/lua_api/l_settings.h
Expand Up @@ -24,51 +24,51 @@ with this program; if not, write to the Free Software Foundation, Inc.,

class Settings;

class LuaSettings : public ModApiBase {
class LuaSettings : public ModApiBase
{
private:
static const char className[];
static const luaL_reg methods[];

// garbage collector
static int gc_object(lua_State* L);
static int gc_object(lua_State *L);

// get(self, key) -> value
static int l_get(lua_State* L);
static int l_get(lua_State *L);

// get_bool(self, key) -> boolean
static int l_get_bool(lua_State* L);
static int l_get_bool(lua_State *L);

// set(self, key, value)
static int l_set(lua_State* L);
static int l_set(lua_State *L);

// remove(self, key) -> success
static int l_remove(lua_State* L);
static int l_remove(lua_State *L);

// get_names(self) -> {key1, ...}
static int l_get_names(lua_State* L);
static int l_get_names(lua_State *L);

// write(self) -> success
static int l_write(lua_State* L);
static int l_write(lua_State *L);

// to_table(self) -> {[key1]=value1,...}
static int l_to_table(lua_State* L);
static int l_to_table(lua_State *L);

bool m_write_allowed;
Settings* m_settings;
Settings *m_settings;
std::string m_filename;

public:
LuaSettings(const char* filename, bool write_allowed);
LuaSettings(const char *filename, bool write_allowed);
~LuaSettings();

// LuaSettings(filename)
// Creates an LuaSettings and leaves it on top of stack
static int create_object(lua_State* L);
static int create_object(lua_State *L);

static LuaSettings* checkobject(lua_State* L, int narg);

static void Register(lua_State* L);
static LuaSettings *checkobject(lua_State *L, int narg);

static void Register(lua_State *L);
};

#endif
10 changes: 5 additions & 5 deletions src/threading/event.h
Expand Up @@ -29,19 +29,19 @@ DEALINGS IN THE SOFTWARE.
#include "threads.h"

#if USE_CPP11_MUTEX
#include <condition_variable>
#include "threading/mutex.h"
#include "threading/mutex_auto_lock.h"
#include <condition_variable>
#include "threading/mutex.h"
#include "threading/mutex_auto_lock.h"
#endif


/** A syncronization primitive that will wake up one waiting thread when signaled.
* Calling @c signal() multiple times before a waiting thread has had a chance
* to notice the signal will wake only one thread. Additionally, if no threads
* are waiting on the event when it is signaled, the next call to @c wait()
* will return (almost) immediately.
*/
class Event {
class Event
{
public:
Event();
#ifndef USE_CPP11_MUTEX
Expand Down
14 changes: 7 additions & 7 deletions src/threading/semaphore.h
Expand Up @@ -21,21 +21,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define THREADING_SEMAPHORE_H

#if defined(_WIN32)
#include <windows.h>
#include <windows.h>
#elif defined(__MACH__) && defined(__APPLE__)
#include <mach/semaphore.h>
#include <mach/semaphore.h>
#else
#include <semaphore.h>
#include <semaphore.h>
#endif

#include "util/basic_macros.h"

class Semaphore {
class Semaphore
{
public:
Semaphore(int val=0);
Semaphore(int val = 0);
~Semaphore();

void post(unsigned int num=1);
void post(unsigned int num = 1);
void wait();
bool wait(unsigned int time_ms);

Expand All @@ -52,4 +53,3 @@ class Semaphore {
};

#endif

0 comments on commit 4af99b7

Please sign in to comment.