Skip to content

Commit

Permalink
Tidy-up C++ headers in demos (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier authored Dec 11, 2024
1 parent 79e5102 commit 0b00ba1
Show file tree
Hide file tree
Showing 27 changed files with 51 additions and 54 deletions.
4 changes: 3 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ Checks:
cert-*,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
performance-*,
-performance-avoid-endl
'
WarningsAsErrors: '*'
HeaderFilterRegex: ''
HeaderFilterRegex: '.*'
ExcludeHeaderFilterRegex: 'include/.*'
UseColor: true
FormatStyle: 'file'
ExtraArgs: ['-std=c++17']
Expand Down
6 changes: 3 additions & 3 deletions cpp/Ice/async/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class HelloI : public Demo::Hello
{
public:
HelloI(const std::shared_ptr<WorkQueue>&);
virtual void
sayHelloAsync(int, std::function<void()>, std::function<void(std::exception_ptr)>, const Ice::Current&);
virtual void shutdown(const Ice::Current&);
void
sayHelloAsync(int, std::function<void()>, std::function<void(std::exception_ptr)>, const Ice::Current&) override;
void shutdown(const Ice::Current&) override;

private:
std::shared_ptr<WorkQueue> _workQueue;
Expand Down
2 changes: 0 additions & 2 deletions cpp/Ice/async/WorkQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

using namespace std;

WorkQueue::WorkQueue() : _done(false) {}

void
WorkQueue::start()
{
Expand Down
4 changes: 1 addition & 3 deletions cpp/Ice/async/WorkQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
class WorkQueue
{
public:
WorkQueue();

void run();

void add(int, std::function<void()>, std::function<void(std::exception_ptr)>);
Expand All @@ -31,7 +29,7 @@ class WorkQueue
std::condition_variable _condition;

std::list<CallbackEntry> _callbacks;
bool _done;
bool _done{false};
std::thread _thread;
};

Expand Down
12 changes: 6 additions & 6 deletions cpp/Ice/asyncInvocation/CalculatorI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
class CalculatorI : public Demo::Calculator
{
public:
virtual int add(int, int, const Ice::Current&) override;
virtual int subtract(int, int, const Ice::Current&) override;
virtual int divide(int, int, int&, const Ice::Current&) override;
virtual int square(int, const Ice::Current&) override;
virtual double squareRoot(int, const Ice::Current&) override;
virtual void shutdown(const Ice::Current&) override;
int add(int, int, const Ice::Current&) override;
int subtract(int, int, const Ice::Current&) override;
int divide(int, int, int&, const Ice::Current&) override;
int square(int, const Ice::Current&) override;
double squareRoot(int, const Ice::Current&) override;
void shutdown(const Ice::Current&) override;
};

#endif
4 changes: 2 additions & 2 deletions cpp/Ice/context/ContextI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
class ContextI : public Demo::Context
{
public:
virtual void call(const Ice::Current&) override;
virtual void shutdown(const Ice::Current&) override;
void call(const Ice::Current&) override;
void shutdown(const Ice::Current&) override;
};

#endif
4 changes: 2 additions & 2 deletions cpp/Ice/hello/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
class HelloI : public Demo::Hello
{
public:
virtual void sayHello(int delay, const Ice::Current&) override;
virtual void shutdown(const Ice::Current&) override;
void sayHello(int delay, const Ice::Current&) override;
void shutdown(const Ice::Current&) override;
};

#endif
2 changes: 1 addition & 1 deletion cpp/Ice/interceptor/AuthenticatorI.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AuthenticatorI : public Demo::Authenticator
{
public:
AuthenticatorI();
virtual std::string getToken(const Ice::Current&) override;
std::string getToken(const Ice::Current&) override;
void validateToken(const std::string&);

private:
Expand Down
6 changes: 3 additions & 3 deletions cpp/Ice/interceptor/ThermostatI.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
class ThermostatI : public Demo::Thermostat
{
public:
virtual float getTemp(const Ice::Current&) override;
virtual void setTemp(float, const Ice::Current&) override;
virtual void shutdown(const Ice::Current&) override;
float getTemp(const Ice::Current&) override;
void setTemp(float, const Ice::Current&) override;
void shutdown(const Ice::Current&) override;

private:
// Temperature in Celsius.
Expand Down
4 changes: 2 additions & 2 deletions cpp/Ice/locator/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
class HelloI : public Demo::Hello
{
public:
virtual void sayHello(const Ice::Current&) override;
virtual void shutdown(const Ice::Current&) override;
void sayHello(const Ice::Current&) override;
void shutdown(const Ice::Current&) override;
};

#endif
2 changes: 1 addition & 1 deletion cpp/Ice/minimal/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class HelloI : public Demo::Hello
{
public:
virtual void sayHello(const Ice::Current&) override;
void sayHello(const Ice::Current&) override;
};

#endif
2 changes: 1 addition & 1 deletion cpp/Ice/session/SessionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class HelloI final : public Hello
const int _id;
};

SessionI::SessionI(string name) : _name(std::move(name)), _nextId(0), _destroy(false)
SessionI::SessionI(string name) : _name(std::move(name))
{
cout << "The session " << _name << " is now created." << endl;
}
Expand Down
4 changes: 2 additions & 2 deletions cpp/Ice/session/SessionI.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class SessionI final : public Demo::Session
private:
std::mutex _mutex;
const std::string _name;
int _nextId; // The per-session id of the next hello object. This is used for tracing purposes.
int _nextId{0}; // The per-session id of the next hello object. This is used for tracing purposes.
std::list<std::optional<Demo::HelloPrx>> _objs; // List of per-session allocated hello objects.
bool _destroy;
bool _destroy{false};
};
#endif
2 changes: 1 addition & 1 deletion cpp/Ice/throughput/StringView.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace Ice

template<class S> static inline void read(S* stream, Util::string_view& v)
{
const char* vdata = 0;
const char* vdata = nullptr;
size_t vsize = 0;

stream->read(vdata, vsize);
Expand Down
3 changes: 1 addition & 2 deletions cpp/Ice/throughput/ThroughputI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ ThroughputI::ThroughputI()
: _byteSeq(Demo::ByteSeqSize),
_stringSeq(Demo::StringSeqSize, "hello"),
_structSeq(Demo::StringDoubleSeqSize, {"hello", 3.14}),
_fixedSeq(Demo::FixedSeqSize, {0, 0, 0.0}),
_warmup(false)
_fixedSeq(Demo::FixedSeqSize, {0, 0, 0.0})
{
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/Ice/throughput/ThroughputI.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ThroughputI final : public Demo::Throughput
Demo::StringDoubleSeq _structSeq;
Demo::FixedSeq _fixedSeq;

bool _warmup;
bool _warmup{false};
};

#endif
2 changes: 1 addition & 1 deletion cpp/IceBox/hello/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class HelloI : public Demo::Hello
{
public:
virtual void sayHello(const Ice::Current&) override;
void sayHello(const Ice::Current&) override;
};

#endif
4 changes: 2 additions & 2 deletions cpp/IceBox/hello/HelloServiceI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
class HelloServiceI : public IceBox::Service
{
public:
virtual void start(const std::string&, const std::shared_ptr<Ice::Communicator>&, const Ice::StringSeq&) override;
void start(const std::string&, const std::shared_ptr<Ice::Communicator>&, const Ice::StringSeq&) override;

virtual void stop() override;
void stop() override;

private:
std::shared_ptr<Ice::ObjectAdapter> _adapter;
Expand Down
4 changes: 2 additions & 2 deletions cpp/IceDiscovery/hello/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
class HelloI : public Demo::Hello
{
public:
virtual void sayHello(int delay, const Ice::Current&) override;
virtual void shutdown(const Ice::Current&) override;
void sayHello(int delay, const Ice::Current&) override;
void shutdown(const Ice::Current&) override;
};

#endif
4 changes: 2 additions & 2 deletions cpp/IceDiscovery/replication/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class HelloI : public Demo::Hello
public:
HelloI(std::string);

virtual std::string getGreeting(const Ice::Current&) override;
virtual void shutdown(const Ice::Current&) override;
std::string getGreeting(const Ice::Current&) override;
void shutdown(const Ice::Current&) override;

private:
const std::string _name;
Expand Down
4 changes: 2 additions & 2 deletions cpp/IceGrid/allocate/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class HelloI : public Demo::Hello
public:
HelloI(std::string);

virtual void sayHello(const Ice::Current&) override;
virtual void shutdown(const Ice::Current&) override;
void sayHello(const Ice::Current&) override;
void shutdown(const Ice::Current&) override;

private:
const std::string _name;
Expand Down
4 changes: 2 additions & 2 deletions cpp/IceGrid/customLocator/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class HelloI : public Demo::Hello
public:
HelloI(std::string);

virtual void sayHello(const Ice::Current&) override;
virtual void shutdown(const Ice::Current&) override;
void sayHello(const Ice::Current&) override;
void shutdown(const Ice::Current&) override;

private:
const std::string _name;
Expand Down
2 changes: 1 addition & 1 deletion cpp/IceGrid/icebox/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class HelloI : public Demo::Hello
public:
HelloI(std::string);

virtual void sayHello(const Ice::Current&) override;
void sayHello(const Ice::Current&) override;

private:
const std::string _serviceName;
Expand Down
4 changes: 2 additions & 2 deletions cpp/IceGrid/icebox/HelloServiceI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
class HelloServiceI : public IceBox::Service
{
public:
virtual void start(const std::string&, const std::shared_ptr<Ice::Communicator>&, const Ice::StringSeq&) override;
void start(const std::string&, const std::shared_ptr<Ice::Communicator>&, const Ice::StringSeq&) override;

virtual void stop() override;
void stop() override;

private:
std::shared_ptr<Ice::ObjectAdapter> _adapter;
Expand Down
4 changes: 2 additions & 2 deletions cpp/IceGrid/secure/HelloI.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class HelloI : public Demo::Hello
public:
HelloI(std::string);

virtual void sayHello(const Ice::Current&) override;
virtual void shutdown(const Ice::Current&) override;
void sayHello(const Ice::Current&) override;
void shutdown(const Ice::Current&) override;

private:
const std::string _name;
Expand Down
4 changes: 2 additions & 2 deletions cpp/IceStorm/counter/CounterObserverI.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ void print(const std::string&);
class CounterObserverI : public Demo::CounterObserver
{
public:
virtual void init(int, const Ice::Current&) override;
virtual void inc(int, const Ice::Current&) override;
void init(int, const Ice::Current&) override;
void inc(int, const Ice::Current&) override;

private:
int _value = 0;
Expand Down
6 changes: 3 additions & 3 deletions cpp/Manual/simpleFilesystem/FilesystemI.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Copyright (c) ZeroC, Inc. All rights reserved.
//

#ifndef __FilesystemI_h__
#define __FilesystemI_h__
#ifndef FilesystemI_h
#define FilesystemI_h

#include <Filesystem.h>
#include <Ice/Ice.h>
Expand All @@ -21,7 +21,7 @@ namespace Filesystem
class NodeI : public virtual Node, public std::enable_shared_from_this<NodeI>
{
public:
virtual std::string name(const Ice::Current&) override;
std::string name(const Ice::Current&) override;
NodeI(std::string, const std::shared_ptr<DirectoryI>&);
void activate(const std::shared_ptr<Ice::ObjectAdapter>&);

Expand Down

0 comments on commit 0b00ba1

Please sign in to comment.