Skip to content

Commit fd90d24

Browse files
committed
[C++] Const qualify arguments of array property methods.
1 parent a34388c commit fd90d24

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppGenerator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ private CharSequence generateArrayProperty(
13221322
indent);
13231323

13241324
sb.append(String.format("\n" +
1325-
indent + " %1$s %2$s(std::uint64_t index) const\n" +
1325+
indent + " %1$s %2$s(const std::uint64_t index) const\n" +
13261326
indent + " {\n" +
13271327
indent + " if (index >= %3$d)\n" +
13281328
indent + " {\n" +
@@ -1344,7 +1344,7 @@ private CharSequence generateArrayProperty(
13441344
indent);
13451345

13461346
sb.append(String.format("\n" +
1347-
indent + " %1$s %2$s(std::uint64_t index, %3$s value)\n" +
1347+
indent + " %1$s %2$s(const std::uint64_t index, const %3$s value)\n" +
13481348
indent + " {\n" +
13491349
indent + " if (index >= %4$d)\n" +
13501350
indent + " {\n" +
@@ -1361,7 +1361,7 @@ private CharSequence generateArrayProperty(
13611361
storeValue));
13621362

13631363
sb.append(String.format("\n" +
1364-
indent + " std::uint64_t get%1$s(char *dst, std::uint64_t length) const\n" +
1364+
indent + " std::uint64_t get%1$s(char *const dst, const std::uint64_t length) const\n" +
13651365
indent + " {\n" +
13661366
indent + " if (length > %2$d)\n" +
13671367
indent + " {\n" +
@@ -1379,7 +1379,7 @@ private CharSequence generateArrayProperty(
13791379
cppTypeName));
13801380

13811381
sb.append(String.format("\n" +
1382-
indent + " %1$s &put%2$s(const char *src) SBE_NOEXCEPT\n" +
1382+
indent + " %1$s &put%2$s(const char *const src) SBE_NOEXCEPT\n" +
13831383
indent + " {\n" +
13841384
indent + " std::memcpy(m_buffer + m_offset + %3$d, src, sizeof(%4$s) * %5$d);\n" +
13851385
indent + " return *this;\n" +
@@ -1426,7 +1426,7 @@ private CharSequence generateArrayProperty(
14261426

14271427
sb.append(String.format("\n" +
14281428
indent + " #if __cplusplus >= 201703L\n" +
1429-
indent + " %1$s &put%2$s(std::string_view str)\n" +
1429+
indent + " %1$s &put%2$s(const std::string_view str)\n" +
14301430
indent + " {\n" +
14311431
indent + " const size_t srcLength = str.length();\n" +
14321432
indent + " if (srcLength > %4$d)\n" +

0 commit comments

Comments
 (0)