Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
c2edaa97
Unverified
Commit
c2edaa97
authored
Oct 08, 2019
by
Rémi Verschelde
Committed by
GitHub
Oct 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #32426 from gianllucah/master
Option to erase a section key in ConfigFile
parents
2078dcbe
54cba54a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
config_file.cpp
core/io/config_file.cpp
+8
-0
config_file.h
core/io/config_file.h
+1
-0
No files found.
core/io/config_file.cpp
View file @
c2edaa97
...
...
@@ -123,6 +123,13 @@ void ConfigFile::erase_section(const String &p_section) {
values
.
erase
(
p_section
);
}
void
ConfigFile
::
erase_section_key
(
const
String
&
p_section
,
const
String
&
p_key
)
{
ERR_FAIL_COND_MSG
(
!
values
.
has
(
p_section
),
"Cannot erase key from nonexistent section '"
+
p_section
+
"'."
);
values
[
p_section
].
erase
(
p_key
);
}
Error
ConfigFile
::
save
(
const
String
&
p_path
)
{
Error
err
;
...
...
@@ -293,6 +300,7 @@ void ConfigFile::_bind_methods() {
ClassDB
::
bind_method
(
D_METHOD
(
"get_section_keys"
,
"section"
),
&
ConfigFile
::
_get_section_keys
);
ClassDB
::
bind_method
(
D_METHOD
(
"erase_section"
,
"section"
),
&
ConfigFile
::
erase_section
);
ClassDB
::
bind_method
(
D_METHOD
(
"erase_section_key"
,
"section"
,
"key"
),
&
ConfigFile
::
erase_section_key
);
ClassDB
::
bind_method
(
D_METHOD
(
"load"
,
"path"
),
&
ConfigFile
::
load
);
ClassDB
::
bind_method
(
D_METHOD
(
"save"
,
"path"
),
&
ConfigFile
::
save
);
...
...
core/io/config_file.h
View file @
c2edaa97
...
...
@@ -60,6 +60,7 @@ public:
void
get_section_keys
(
const
String
&
p_section
,
List
<
String
>
*
r_keys
)
const
;
void
erase_section
(
const
String
&
p_section
);
void
erase_section_key
(
const
String
&
p_section
,
const
String
&
p_key
);
Error
save
(
const
String
&
p_path
);
Error
load
(
const
String
&
p_path
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment