Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
vite
Commits
0acd7941
Commit
0acd7941
authored
Feb 07, 2009
by
Johnny Jazeix
Browse files
Ajout du makefile et de la compilation
parent
7ddc3b0a
Changes
10
Hide whitespace changes
Inline
Side-by-side
values/color.cpp
View file @
0acd7941
...
...
@@ -8,7 +8,7 @@ Color::Color(double r, double g, double b) {
bool
Color
::
instantiate
(
const
std
::
string
&
in
,
Color
&
out
)
{
double
r
,
g
,
b
;
if
(
sscanf
(
in
,
"%lf %lf %lf"
,
&
r
,
&
g
,
&
b
)
!=
3
)
if
(
sscanf
(
in
.
c_str
()
,
"%lf %lf %lf"
,
&
r
,
&
g
,
&
b
)
!=
3
)
return
false
;
out
=
Color
(
r
,
g
,
b
);
return
true
;
...
...
values/color.hpp
View file @
0acd7941
...
...
@@ -10,6 +10,7 @@
*
*/
#include <sstream>
#include "value.hpp"
/*!
...
...
values/date.cpp
View file @
0acd7941
...
...
@@ -7,10 +7,11 @@ Date::Date(double value){
bool
Date
::
instantiate
(
const
std
::
string
&
in
,
Date
&
out
){
double
value
=
0.0
;
if
(
sscanf
(
in
,
"%lf"
,
&
value
)
!=
1
){
if
(
sscanf
(
in
.
c_str
()
,
"%lf"
,
&
value
)
!=
1
){
return
false
;
};
out
=
Date
(
value
);
return
true
;
}
std
::
string
Date
::
to_string
()
const
{
...
...
values/double.cpp
View file @
0acd7941
...
...
@@ -7,10 +7,11 @@ Double::Double(double value){
bool
Double
::
instantiate
(
const
std
::
string
&
in
,
Double
&
out
){
double
value
=
0.0
;
if
(
sscanf
(
in
,
"%lf"
,
&
value
)
!=
1
){
if
(
sscanf
(
in
.
c_str
()
,
"%lf"
,
&
value
)
!=
1
){
return
false
;
};
out
=
Double
(
value
);
return
true
;
}
std
::
string
Double
::
to_string
()
const
{
...
...
values/hex.cpp
View file @
0acd7941
...
...
@@ -6,15 +6,15 @@ Hex::Hex(int n) {
bool
Hex
::
instantiate
(
const
std
::
string
&
in
,
Hex
&
out
)
{
int
n
;
if
(
sscanf
(
in
,
"%X"
,
&
n
)
!=
1
)
if
(
sscanf
(
in
.
c_str
()
,
"%X"
,
&
n
)
!=
1
)
return
false
;
out
=
Integer
(
n
);
out
=
Hex
(
n
);
return
true
;
}
std
::
string
Hex
::
to_string
()
const
{
std
::
ostringstream
oss
;
oss
.
flags
(
ios
::
hex
);
oss
.
flags
(
std
::
ios
::
hex
);
oss
<<
_value
;
return
oss
.
str
();
}
values/hex.hpp
View file @
0acd7941
...
...
@@ -11,6 +11,8 @@
*/
#include <sstream>
#include <iostream>
#include <fstream>
#include <cstdio>
#include "value.hpp"
...
...
values/integer.cpp
View file @
0acd7941
...
...
@@ -6,7 +6,7 @@ Integer::Integer(int n) {
bool
Integer
::
instantiate
(
const
std
::
string
&
in
,
Integer
&
out
)
{
int
n
;
if
(
sscanf
(
in
,
"%d"
,
&
n
)
!=
1
)
if
(
sscanf
(
in
.
c_str
()
,
"%d"
,
&
n
)
!=
1
)
return
false
;
out
=
Integer
(
n
);
return
true
;
...
...
values/makefile
0 → 100755
View file @
0acd7941
LD
=
g++
OBJ
=
color.o date.o double.o hex.o integer.o name.o string.o
OPT
=
-g
-Wall
-W
LIBS
=
all
:
$(OBJ)
$(OBJ)
:
%.o: %.cpp %.hpp value.hpp
$(LD)
-c
$<
$(OPT)
clean
:
$(RM)
*
.o
*
.
*
~ makefile~
values/name.cpp
View file @
0acd7941
...
...
@@ -13,7 +13,7 @@ Name::Name(name_only_t name_only, std::string name) {
_alias
.
clear
();
}
Name
::
Name
(
alias_only_t
,
std
::
string
alias
)
{
Name
::
Name
(
alias_only_t
alias_only
,
std
::
string
alias
)
{
_name
.
clear
();
_alias
=
alias
;
}
...
...
@@ -26,5 +26,5 @@ std::string Name::to_string() const {
}
bool
Name
::
operator
==
(
String
&
s
)
const
{
return
_name
==
s
||
_alias
==
s
;
return
(
s
==
_name
||
s
==
_alias
)
;
}
values/value.hpp
View file @
0acd7941
...
...
@@ -11,6 +11,7 @@
*/
#include <string>
/*!
*
* \class Value
...
...
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