-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support to have configuration by STGroup (#108)
* Refs #19960. Support to have config by STGroup Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev> * Refs #19960. Fix conding style. Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev> * Refs #19960. Apply suggestions Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev> --------- Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
- Loading branch information
Showing
8 changed files
with
218 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/com/eprosima/idl/generator/manager/TemplateST.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.eprosima.idl.generator.manager; | ||
|
||
import org.stringtemplate.v4.*; | ||
|
||
public class TemplateST | ||
{ | ||
public TemplateST(TemplateSTGroup parent_group, String template_name) | ||
{ | ||
parent_group_ = parent_group; | ||
st_ = parent_group_.get_stgroup().getInstanceOf(template_name); | ||
} | ||
|
||
public ST get_st() | ||
{ | ||
return st_; | ||
} | ||
|
||
public TemplateSTGroup get_template_stgroup() | ||
{ | ||
return parent_group_; | ||
} | ||
|
||
private ST st_ = null; | ||
private TemplateSTGroup parent_group_ = null; | ||
}; |
57 changes: 57 additions & 0 deletions
57
src/main/java/com/eprosima/idl/generator/manager/TemplateSTGroup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.eprosima.idl.generator.manager; | ||
|
||
import org.stringtemplate.v4.*; | ||
|
||
public class TemplateSTGroup | ||
{ | ||
public TemplateSTGroup(String groupname) | ||
{ | ||
st_group_ = new STGroupFile(groupname, '$', '$'); | ||
} | ||
|
||
public TemplateSTGroup(String groupname, String text) | ||
{ | ||
st_group_ = new STGroupString(groupname, text, '$', '$'); | ||
} | ||
|
||
public STGroup get_stgroup() | ||
{ | ||
return st_group_; | ||
} | ||
|
||
/*! | ||
* @brief Returns if the current `Context` scope will be remove from the scoped name of types (returned by | ||
* `getScopedname()`). | ||
*/ | ||
public boolean is_enabled_using_explicitly_modules() | ||
{ | ||
return using_explicitly_modules_; | ||
} | ||
|
||
/*! | ||
* @brief Enable removing the current `Context` scope from the scoped name of types (returned by `getScopedname()`). | ||
*/ | ||
public void enable_using_explicitly_modules() | ||
{ | ||
using_explicitly_modules_ = true; | ||
} | ||
|
||
private STGroup st_group_ = null; | ||
|
||
//! If set, the scoped name of types (returned by `getScopedname()`) will remove the current `Context` scope. | ||
private boolean using_explicitly_modules_ = false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.