Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
b82b355e
Commit
b82b355e
authored
Jun 01, 2013
by
Davis King
Browse files
Added an openmode argument to the basic_utf8_ifstream.
parent
de6109a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
12 deletions
+28
-12
dlib/unicode/unicode.h
dlib/unicode/unicode.h
+12
-8
dlib/unicode/unicode_abstract.h
dlib/unicode/unicode_abstract.h
+16
-4
No files found.
dlib/unicode/unicode.h
View file @
b82b355e
...
@@ -544,41 +544,45 @@ namespace dlib
...
@@ -544,41 +544,45 @@ namespace dlib
)
:
std
::
basic_istream
<
charT
>
(
&
buf
),
buf
(
fin
)
{}
)
:
std
::
basic_istream
<
charT
>
(
&
buf
),
buf
(
fin
)
{}
basic_utf8_ifstream
(
basic_utf8_ifstream
(
const
char
*
file_name
const
char
*
file_name
,
std
::
ios_base
::
openmode
mode
=
std
::
ios
::
in
)
:
)
:
std
::
basic_istream
<
charT
>
(
&
buf
),
std
::
basic_istream
<
charT
>
(
&
buf
),
buf
(
fin
)
buf
(
fin
)
{
{
fin
.
open
(
file_name
);
fin
.
open
(
file_name
,
mode
);
// make this have the same error state as fin
// make this have the same error state as fin
this
->
clear
(
fin
.
rdstate
());
this
->
clear
(
fin
.
rdstate
());
}
}
basic_utf8_ifstream
(
basic_utf8_ifstream
(
const
std
::
string
&
file_name
const
std
::
string
&
file_name
,
std
::
ios_base
::
openmode
mode
=
std
::
ios
::
in
)
:
)
:
std
::
basic_istream
<
charT
>
(
&
buf
),
std
::
basic_istream
<
charT
>
(
&
buf
),
buf
(
fin
)
buf
(
fin
)
{
{
fin
.
open
(
file_name
.
c_str
());
fin
.
open
(
file_name
.
c_str
()
,
mode
);
// make this have the same error state as fin
// make this have the same error state as fin
this
->
clear
(
fin
.
rdstate
());
this
->
clear
(
fin
.
rdstate
());
}
}
void
open
(
void
open
(
const
std
::
string
&
file_name
const
std
::
string
&
file_name
,
std
::
ios_base
::
openmode
mode
=
std
::
ios
::
in
)
)
{
{
open
(
file_name
.
c_str
());
open
(
file_name
.
c_str
()
,
mode
);
}
}
void
open
(
void
open
(
const
char
*
file_name
const
char
*
file_name
,
std
::
ios_base
::
openmode
mode
=
std
::
ios
::
in
)
)
{
{
fin
.
close
();
fin
.
close
();
fin
.
clear
();
fin
.
clear
();
fin
.
open
(
file_name
);
fin
.
open
(
file_name
,
mode
);
// make this have the same error state as fin
// make this have the same error state as fin
this
->
clear
(
fin
.
rdstate
());
this
->
clear
(
fin
.
rdstate
());
}
}
...
...
dlib/unicode/unicode_abstract.h
View file @
b82b355e
...
@@ -170,35 +170,47 @@ namespace dlib
...
@@ -170,35 +170,47 @@ namespace dlib
!*/
!*/
basic_utf8_ifstream
(
basic_utf8_ifstream
(
const
char
*
file_name
const
char
*
file_name
,
std
::
ios_base
::
openmode
mode
=
std
::
ios
::
in
);
);
/*!
/*!
ensures
ensures
- tries to open the given file for reading by this stream
- tries to open the given file for reading by this stream
- mode is interpreted exactly the same was as the open mode
argument used by std::ifstream.
!*/
!*/
basic_utf8_ifstream
(
basic_utf8_ifstream
(
const
std
::
string
&
file_name
const
std
::
string
&
file_name
,
std
::
ios_base
::
openmode
mode
=
std
::
ios
::
in
);
);
/*!
/*!
ensures
ensures
- tries to open the given file for reading by this stream
- tries to open the given file for reading by this stream
- mode is interpreted exactly the same was as the open mode
argument used by std::ifstream.
!*/
!*/
void
open
(
void
open
(
const
std
::
string
&
file_name
const
std
::
string
&
file_name
,
std
::
ios_base
::
openmode
mode
=
std
::
ios
::
in
);
);
/*!
/*!
ensures
ensures
- tries to open the given file for reading by this stream
- tries to open the given file for reading by this stream
- mode is interpreted exactly the same was as the open mode
argument used by std::ifstream.
!*/
!*/
void
open
(
void
open
(
const
char
*
file_name
const
char
*
file_name
,
std
::
ios_base
::
openmode
mode
=
std
::
ios
::
in
);
);
/*!
/*!
ensures
ensures
- tries to open the given file for reading by this stream
- tries to open the given file for reading by this stream
- mode is interpreted exactly the same was as the open mode
argument used by std::ifstream.
!*/
!*/
void
close
(
void
close
(
...
...
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