Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
32c75310
There was an error fetching the commit references. Please try again later.
Commit
32c75310
authored
6 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Moved stuff from FileName.cpp to FileName.hpp
parent
7d1069bb
No related branches found
No related tags found
1 merge request
!22
Header only
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/TNL/CMakeLists.txt
+0
-1
0 additions, 1 deletion
src/TNL/CMakeLists.txt
src/TNL/FileName.cpp
+0
-98
0 additions, 98 deletions
src/TNL/FileName.cpp
src/TNL/FileName.h
+2
-3
2 additions, 3 deletions
src/TNL/FileName.h
src/TNL/FileName.hpp
+84
-0
84 additions, 0 deletions
src/TNL/FileName.hpp
with
86 additions
and
102 deletions
src/TNL/CMakeLists.txt
+
0
−
1
View file @
32c75310
...
...
@@ -39,7 +39,6 @@ set( headers
StaticVectorFor.h
)
set
(
common_SOURCES
FileName.cpp
String.cpp
)
set
(
tnl_SOURCES
${
tnl_config_SOURCES
}
...
...
This diff is collapsed.
Click to expand it.
src/TNL/FileName.cpp
deleted
100644 → 0
+
0
−
98
View file @
7d1069bb
/***************************************************************************
FileName.cpp - description
-------------------
begin : 2007/06/18
copyright : (C) 2007 by Tomas Oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/* See Copyright Notice in tnl/Copyright */
#include
<sstream>
#include
<iomanip>
#include
<cstring>
#include
<cstdlib>
#include
<TNL/FileName.h>
#include
<TNL/String.h>
#include
<TNL/Math.h>
namespace
TNL
{
FileName
::
FileName
()
:
index
(
0
),
digitsCount
(
5
)
{
}
FileName
::
FileName
(
const
String
&
fileNameBase
)
:
fileNameBase
(
fileNameBase
),
index
(
0
),
digitsCount
(
5
)
{
}
FileName
::
FileName
(
const
String
&
fileNameBase
,
const
String
&
extension
)
:
fileNameBase
(
fileNameBase
),
extension
(
extension
),
index
(
0
),
digitsCount
(
5
)
{
}
void
FileName
::
setFileNameBase
(
const
String
&
fileNameBase
)
{
this
->
fileNameBase
=
fileNameBase
;
}
void
FileName
::
setExtension
(
const
String
&
extension
)
{
this
->
extension
=
extension
;
}
void
FileName
::
setIndex
(
const
int
index
)
{
this
->
index
=
index
;
}
void
FileName
::
setDigitsCount
(
const
int
digitsCount
)
{
this
->
digitsCount
=
digitsCount
;
}
void
FileName
::
setDistributedSystemNodeId
(
int
nodeId
)
{
this
->
distributedSystemNodeId
=
"-"
;
this
->
distributedSystemNodeId
+=
convertToString
(
nodeId
);
}
String
FileName
::
getFileName
()
{
std
::
stringstream
stream
;
stream
<<
this
->
fileNameBase
<<
std
::
setw
(
this
->
digitsCount
)
<<
std
::
setfill
(
'0'
)
<<
this
->
index
<<
this
->
distributedSystemNodeId
<<
"."
<<
this
->
extension
;
return
String
(
stream
.
str
().
data
()
);
}
String
getFileExtension
(
const
String
fileName
)
{
int
size
=
fileName
.
getLength
();
int
i
=
1
;
while
(
fileName
.
getString
()[
size
-
i
]
!=
'.'
&&
size
>
i
)
i
++
;
String
result
;
result
.
setString
(
fileName
.
getString
(),
size
-
i
+
1
);
return
result
;
}
void
removeFileExtension
(
String
&
fileName
)
{
int
size
=
fileName
.
getLength
();
int
i
=
1
;
while
(
fileName
.
getString
()[
size
-
i
]
!=
'.'
&&
size
>
i
)
i
++
;
fileName
.
setString
(
fileName
.
getString
(),
0
,
i
);
}
}
// namespace TNL
This diff is collapsed.
Click to expand it.
src/TNL/FileName.h
+
2
−
3
View file @
32c75310
...
...
@@ -8,7 +8,7 @@
/* See Copyright Notice in tnl/Copyright */
#pragma once
#pragma once
#include
<TNL/String.h>
...
...
@@ -70,13 +70,12 @@ class FileName
/// Creates particular file name using \e fileNameBase, \e digitsCount,
/// \e index and \e extension.
String
getFileName
();
protected:
String
fileNameBase
,
extension
,
distributedSystemNodeId
;
int
index
,
digitsCount
;
};
}
// namespace TNL
...
...
This diff is collapsed.
Click to expand it.
src/TNL/FileName.hpp
+
84
−
0
View file @
32c75310
...
...
@@ -8,10 +8,64 @@
/* See Copyright Notice in tnl/Copyright */
#pragma once
#include
<sstream>
#include
<iomanip>
#include
<TNL/FileName.h>
#include
<TNL/String.h>
#include
<TNL/Math.h>
namespace
TNL
{
inline
FileName
::
FileName
()
:
index
(
0
),
digitsCount
(
5
)
{
}
inline
FileName
::
FileName
(
const
String
&
fileNameBase
)
:
fileNameBase
(
fileNameBase
),
index
(
0
),
digitsCount
(
5
)
{
}
inline
FileName
::
FileName
(
const
String
&
fileNameBase
,
const
String
&
extension
)
:
fileNameBase
(
fileNameBase
),
extension
(
extension
),
index
(
0
),
digitsCount
(
5
)
{
}
inline
void
FileName
::
setFileNameBase
(
const
String
&
fileNameBase
)
{
this
->
fileNameBase
=
fileNameBase
;
}
inline
void
FileName
::
setExtension
(
const
String
&
extension
)
{
this
->
extension
=
extension
;
}
inline
void
FileName
::
setIndex
(
const
int
index
)
{
this
->
index
=
index
;
}
inline
void
FileName
::
setDigitsCount
(
const
int
digitsCount
)
{
this
->
digitsCount
=
digitsCount
;
}
inline
void
FileName
::
setDistributedSystemNodeId
(
int
nodeId
)
{
this
->
distributedSystemNodeId
=
"-"
;
this
->
distributedSystemNodeId
+=
convertToString
(
nodeId
);
}
template
<
typename
Coordinates
>
void
FileName
::
...
...
@@ -26,4 +80,34 @@ setDistributedSystemNodeId( const Coordinates& nodeId )
}
}
inline
String
FileName
::
getFileName
()
{
std
::
stringstream
stream
;
stream
<<
this
->
fileNameBase
<<
std
::
setw
(
this
->
digitsCount
)
<<
std
::
setfill
(
'0'
)
<<
this
->
index
<<
this
->
distributedSystemNodeId
<<
"."
<<
this
->
extension
;
return
String
(
stream
.
str
().
data
()
);
}
inline
String
getFileExtension
(
const
String
fileName
)
{
int
size
=
fileName
.
getLength
();
int
i
=
1
;
while
(
fileName
.
getString
()[
size
-
i
]
!=
'.'
&&
size
>
i
)
i
++
;
String
result
;
result
.
setString
(
fileName
.
getString
(),
size
-
i
+
1
);
return
result
;
}
inline
void
removeFileExtension
(
String
&
fileName
)
{
int
size
=
fileName
.
getLength
();
int
i
=
1
;
while
(
fileName
.
getString
()[
size
-
i
]
!=
'.'
&&
size
>
i
)
i
++
;
fileName
.
setString
(
fileName
.
getString
(),
0
,
i
);
}
}
// namespace TNL
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment