Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
b6d8c9d9
Commit
b6d8c9d9
authored
Apr 11, 2016
by
Philipp Hasper
Committed by
Alexander Alekhin
Apr 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
operator<< handles keys starting with underscore
parent
52ba3778
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
persistence.cpp
modules/core/src/persistence.cpp
+1
-1
test_io.cpp
modules/core/test/test_io.cpp
+11
-0
No files found.
modules/core/src/persistence.cpp
View file @
b6d8c9d9
...
...
@@ -5248,7 +5248,7 @@ FileStorage& operator << (FileStorage& fs, const string& str)
}
else
if
(
fs
.
state
==
NAME_EXPECTED
+
INSIDE_MAP
)
{
if
(
!
cv_isalpha
(
*
_str
)
)
if
(
!
cv_isalpha
(
*
_str
)
&&
*
_str
!=
'_'
)
CV_Error_
(
CV_StsError
,
(
"Incorrect element name %s"
,
_str
)
);
fs
.
elname
=
str
;
fs
.
state
=
VALUE_EXPECTED
+
INSIDE_MAP
;
...
...
modules/core/test/test_io.cpp
View file @
b6d8c9d9
...
...
@@ -522,3 +522,14 @@ TEST(Core_InputOutput, FileStorage)
sprintf
(
arr
,
"sprintf is hell %d"
,
666
);
EXPECT_NO_THROW
(
f
<<
arr
);
}
TEST
(
Core_InputOutput
,
FileStorageKey
)
{
cv
::
FileStorage
f
(
"dummy.yml"
,
cv
::
FileStorage
::
WRITE
|
cv
::
FileStorage
::
MEMORY
);
EXPECT_NO_THROW
(
f
<<
"key1"
<<
"value1"
);
EXPECT_NO_THROW
(
f
<<
"_key2"
<<
"value2"
);
EXPECT_NO_THROW
(
f
<<
"key_3"
<<
"value3"
);
const
std
::
string
expected
=
"%YAML:1.0
\n
key1: value1
\n
_key2: value2
\n
key_3: value3
\n
"
;
ASSERT_STREQ
(
f
.
releaseAndGetString
().
c_str
(),
expected
.
c_str
());
}
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