Skip to content

Commit 1b82901

Browse files
committed
[C++]: Enhance intermediate representation to allow for C++ nested namespaces
1 parent 23a995c commit 1b82901

File tree

1 file changed

+15
-0
lines changed
  • sbe-tool/src/main/java/uk/co/real_logic/sbe/ir

1 file changed

+15
-0
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Ir.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.agrona.Verify;
1919

2020
import java.util.*;
21+
import java.util.regex.Pattern;
2122

2223
/**
2324
* Intermediate representation of SBE messages to be used for the generation of encoders and decoders
@@ -35,6 +36,8 @@ public class Ir
3536
private final Map<Long, List<Token>> messagesByIdMap = new HashMap<>();
3637
private final Map<String, List<Token>> typesByNameMap = new HashMap<>();
3738

39+
private final String[] namespaces;
40+
3841
/**
3942
* Create a new IR container taking a defensive copy of the headerStructure {@link Token}s passed.
4043
*
@@ -62,6 +65,8 @@ public Ir(
6265
this.version = version;
6366
this.semanticVersion = semanticVersion;
6467
this.headerStructure = new HeaderStructure(new ArrayList<>(headerTokens));
68+
69+
this.namespaces = Pattern.compile("\\.").split(namespaceName == null ? packageName : namespaceName);
6570
}
6671

6772
/**
@@ -153,6 +158,16 @@ public String namespaceName()
153158
return namespaceName;
154159
}
155160

161+
/**
162+
* Get the namespaces array to be used for generated code.
163+
*
164+
* @return the namespaces array to be used for generated code.
165+
*/
166+
public String[] namespaces()
167+
{
168+
return namespaces;
169+
}
170+
156171
/**
157172
* Get the id number of the schema.
158173
*

0 commit comments

Comments
 (0)