Skip to content

Commit

Permalink
Renaming files and classes in the Demo protocol.
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Feb 13, 2024
1 parent c10c737 commit 4046a68
Show file tree
Hide file tree
Showing 25 changed files with 108 additions and 108 deletions.
2 changes: 1 addition & 1 deletion demo/cc_plugin/AllMessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include <tuple>
#include "cc_plugin/Message.h"
#include "cc_plugin/DemoMessage.h"

#include "cc_plugin/message/IntValues.h"
#include "cc_plugin/message/EnumValues.h"
Expand Down
12 changes: 6 additions & 6 deletions demo/cc_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ function (cc_plugin_demo)
set (refresh_plugin_header TRUE)
if ((NOT EXISTS ${stamp_file}) OR (${meta_file} IS_NEWER_THAN ${stamp_file}))
execute_process(
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/Plugin.h)
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/DemoPlugin.h)
execute_process(
COMMAND ${CMAKE_COMMAND} -E touch ${stamp_file})
endif ()


set (src
Plugin.h
Plugin.cpp
Protocol.cpp
TransportMessage.cpp
Message.cpp
DemoPlugin.h
DemoPlugin.cpp
DemoProtocol.cpp
DemoTransportMessage.cpp
DemoMessage.cpp
message/IntValues.cpp
message/EnumValues.cpp
message/BitmaskValues.cpp
Expand Down
12 changes: 6 additions & 6 deletions demo/cc_plugin/Message.cpp → demo/cc_plugin/DemoMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "Message.h"
#include "DemoMessage.h"

#include <cassert>

Expand All @@ -35,16 +35,16 @@ static QVariantList createFieldsProperties()
QVariantList props;
props.append(cc::property::field::IntValue().name("Version").serialisedHidden().hiddenWhenReadOnly().asMap());

assert(props.size() == demo::Message<>::TransportFieldIdx_numOfValues);
assert(props.size() == demo::DemoMessage<>::TransportFieldIdx_numOfValues);
return props;
}

} // namespace

Message::Message() = default;
Message::~Message() noexcept = default;
DemoMessage::DemoMessage() = default;
DemoMessage::~DemoMessage() noexcept = default;

const QVariantList& Message::extraTransportFieldsPropertiesImpl() const
const QVariantList& DemoMessage::extraTransportFieldsPropertiesImpl() const
{
if (getId() != demo::MsgId_Optionals) {
return Base::extraTransportFieldsPropertiesImpl();
Expand All @@ -54,7 +54,7 @@ const QVariantList& Message::extraTransportFieldsPropertiesImpl() const
return Props;
}

QString Message::idAsStringImpl() const
QString DemoMessage::idAsStringImpl() const
{
return QString("0x%1").arg(getId(), 2, 16, QChar('0'));
}
Expand Down
10 changes: 5 additions & 5 deletions demo/cc_plugin/Message.h → demo/cc_plugin/DemoMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
#pragma once

#include "cc_tools_qt/cc_tools_qt.h"
#include "demo/Message.h"
#include "demo/DemoMessage.h"

namespace demo
{

namespace cc_plugin
{

class Message : public cc_tools_qt::MessageBase<demo::Message>
class DemoMessage : public cc_tools_qt::MessageBase<demo::DemoMessage>
{
using Base = cc_tools_qt::MessageBase<demo::Message>;
using Base = cc_tools_qt::MessageBase<demo::DemoMessage>;
public:
Message();
virtual ~Message() noexcept;
DemoMessage();
virtual ~DemoMessage() noexcept;

protected:

Expand Down
10 changes: 5 additions & 5 deletions demo/cc_plugin/Plugin.cpp → demo/cc_plugin/DemoPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.


#include "Plugin.h"
#include "Protocol.h"
#include "DemoPlugin.h"
#include "DemoProtocol.h"

namespace cc = cc_tools_qt;

Expand All @@ -27,17 +27,17 @@ namespace demo
namespace cc_plugin
{

Plugin::Plugin()
DemoPlugin::DemoPlugin()
{
pluginProperties()
.setProtocolCreateFunc(
[]()
{
return cc::ProtocolPtr(new Protocol());
return cc::ProtocolPtr(new DemoProtocol());
});
}

Plugin::~Plugin() noexcept = default;
DemoPlugin::~DemoPlugin() noexcept = default;

} // namespace cc_plugin

Expand Down
6 changes: 3 additions & 3 deletions demo/cc_plugin/Plugin.h → demo/cc_plugin/DemoPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ namespace demo
namespace cc_plugin
{

class Plugin : public cc_tools_qt::Plugin
class DemoPlugin : public cc_tools_qt::Plugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "cc.DemoProtocol" FILE "demo.json")
Q_INTERFACES(cc_tools_qt::Plugin)

public:
Plugin();
~Plugin() noexcept;
DemoPlugin();
~DemoPlugin() noexcept;
};

} // namespace cc_plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "Protocol.h"
#include "DemoProtocol.h"

#include "comms/comms.h"

Expand All @@ -27,9 +27,9 @@ namespace demo
namespace cc_plugin
{

Protocol::~Protocol() noexcept = default;
DemoProtocol::~DemoProtocol() noexcept = default;

const QString& Protocol::nameImpl() const
const QString& DemoProtocol::nameImpl() const
{
static const QString& Str("Demo");
return Str;
Expand Down
14 changes: 7 additions & 7 deletions demo/cc_plugin/Protocol.h → demo/cc_plugin/DemoProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@
#pragma once

#include "cc_tools_qt/cc_tools_qt.h"
#include "cc_plugin/Stack.h"
#include "cc_plugin/TransportMessage.h"
#include "cc_plugin/DemoStack.h"
#include "cc_plugin/DemoTransportMessage.h"

namespace demo
{

namespace cc_plugin
{

class Protocol : public
class DemoProtocol : public
cc_tools_qt::ProtocolBase<
cc_plugin::Stack,
TransportMessage
cc_plugin::DemoStack,
DemoTransportMessage
>
{
public:
Protocol() = default;
virtual ~Protocol() noexcept;
DemoProtocol() = default;
virtual ~DemoProtocol() noexcept;

protected:
virtual const QString& nameImpl() const override;
Expand Down
6 changes: 3 additions & 3 deletions demo/cc_plugin/Stack.h → demo/cc_plugin/DemoStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "demo/Stack.h"
#include "Message.h"
#include "DemoMessage.h"
#include "AllMessages.h"

namespace demo
Expand All @@ -28,8 +28,8 @@ namespace demo
namespace cc_plugin
{

using Stack = demo::Stack<
cc_plugin::Message,
using DemoStack = demo::Stack<
cc_plugin::DemoMessage,
cc_plugin::AllMessages
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "TransportMessage.h"
#include "DemoTransportMessage.h"

#include <cassert>

Expand Down Expand Up @@ -74,19 +74,19 @@ QVariantList createFieldsProperties()
props.append(cc::property::field::ForField<demo::VersionField>().name("VERSION").asMap());
props.append(cc::property::field::ForField<demo::DataField<> >().name("PAYLOAD").asMap());
props.append(cc::property::field::ForField<demo::ChecksumField>().name("CHECKSUM").asMap());
assert(props.size() == TransportMessage::FieldIdx_NumOfValues);
assert(props.size() == DemoTransportMessage::FieldIdx_NumOfValues);
return props;
}

} // namespace

const QVariantList& TransportMessage::fieldsPropertiesImpl() const
const QVariantList& DemoTransportMessage::fieldsPropertiesImpl() const
{
static const auto Props = createFieldsProperties();
return Props;
}

comms::ErrorStatus TransportMessage::readImpl(ReadIterator& iter, std::size_t size)
comms::ErrorStatus DemoTransportMessage::readImpl(ReadIterator& iter, std::size_t size)
{
static const auto ChecksumLen =
sizeof(demo::ChecksumField::ValueType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
#pragma once

#include "cc_tools_qt/cc_tools_qt.h"
#include "cc_plugin/Message.h"
#include "cc_plugin/Stack.h"
#include "cc_plugin/DemoMessage.h"
#include "cc_plugin/DemoStack.h"

namespace demo
{

namespace cc_plugin
{

using TransportMessageFields =
using DemoTransportMessageFields =
std::tuple<
demo::SyncField,
demo::LengthField,
Expand All @@ -39,10 +39,10 @@ using TransportMessageFields =
>;


class TransportMessage : public
class DemoTransportMessage : public
cc_tools_qt::TransportMessageBase<
cc_plugin::Message,
TransportMessageFields
cc_plugin::DemoMessage,
DemoTransportMessageFields
>
{
public:
Expand All @@ -57,7 +57,7 @@ class TransportMessage : public
FieldIdx_NumOfValues
};

static_assert(FieldIdx_NumOfValues == std::tuple_size<TransportMessageFields>::value,
static_assert(FieldIdx_NumOfValues == std::tuple_size<DemoTransportMessageFields>::value,
"Wrong indices");

protected:
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/Bitfields.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "cc_tools_qt/cc_tools_qt.h"
#include "demo/message/Bitfields.h"
#include "cc_plugin/Message.h"
#include "cc_plugin/DemoMessage.h"

namespace demo
{
Expand All @@ -33,7 +33,7 @@ namespace message

class Bitfields : public
cc_tools_qt::ProtocolMessageBase<
demo::message::Bitfields<demo::cc_plugin::Message>,
demo::message::Bitfields<demo::cc_plugin::DemoMessage>,
Bitfields>
{
public:
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/BitmaskValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "cc_tools_qt/cc_tools_qt.h"
#include "demo/message/BitmaskValues.h"
#include "cc_plugin/Message.h"
#include "cc_plugin/DemoMessage.h"

namespace demo
{
Expand All @@ -33,7 +33,7 @@ namespace message

class BitmaskValues : public
cc_tools_qt::ProtocolMessageBase<
demo::message::BitmaskValues<demo::cc_plugin::Message>,
demo::message::BitmaskValues<demo::cc_plugin::DemoMessage>,
BitmaskValues>
{
public:
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/EnumValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "cc_tools_qt/cc_tools_qt.h"
#include "demo/message/EnumValues.h"
#include "cc_plugin/Message.h"
#include "cc_plugin/DemoMessage.h"

namespace demo
{
Expand All @@ -33,7 +33,7 @@ namespace message

class EnumValues : public
cc_tools_qt::ProtocolMessageBase<
demo::message::EnumValues<demo::cc_plugin::Message>,
demo::message::EnumValues<demo::cc_plugin::DemoMessage>,
EnumValues>
{
public:
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/FloatValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "cc_tools_qt/cc_tools_qt.h"
#include "demo/message/FloatValues.h"
#include "cc_plugin/Message.h"
#include "cc_plugin/DemoMessage.h"

namespace demo
{
Expand All @@ -33,7 +33,7 @@ namespace message

class FloatValues : public
cc_tools_qt::ProtocolMessageBase<
demo::message::FloatValues<demo::cc_plugin::Message>,
demo::message::FloatValues<demo::cc_plugin::DemoMessage>,
FloatValues>
{
public:
Expand Down
4 changes: 2 additions & 2 deletions demo/cc_plugin/message/IntValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "cc_tools_qt/cc_tools_qt.h"
#include "demo/message/IntValues.h"
#include "cc_plugin/Message.h"
#include "cc_plugin/DemoMessage.h"

namespace demo
{
Expand All @@ -33,7 +33,7 @@ namespace message

class IntValues : public
cc_tools_qt::ProtocolMessageBase<
demo::message::IntValues<demo::cc_plugin::Message>,
demo::message::IntValues<demo::cc_plugin::DemoMessage>,
IntValues>
{
public:
Expand Down
Loading

0 comments on commit 4046a68

Please sign in to comment.