Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
⚠
Problème réseau au niveau INRAE entre 10h15 et 10h35 aujourd'hui
⚠
Open sidebar
QTL
spell-qtl
Commits
6304b230
Commit
6304b230
authored
Jun 23, 2017
by
Damien Leroux
Browse files
Started implementing excel output.
parent
c55ce20e
Changes
4
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
6304b230
...
...
@@ -128,7 +128,7 @@ if(${BUILD_FOR_DEPLOYMENT})
SET_SOURCE_FILES_PROPERTIES
(
${
SPELL_PEDIGREE_SRC
}
${
SPELL_MARKER_SRC
}
${
SPELL_QTL_SRC
}
PROPERTIES
OBJECT_DEPENDS glibc.h
COMPILE_FLAGS
"-include
${
CMAKE_BINARY_DIR
}
/glibc.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
)
COMPILE_FLAGS
"-include
${
CMAKE_BINARY_DIR
}
/glibc.h
-flto
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
)
#add_dependencies(stdc++ libstdc++.a)
#add_dependencies(gmp libgmp.a)
...
...
@@ -138,7 +138,7 @@ if(${BUILD_FOR_DEPLOYMENT})
MESSAGE
(
STATUS
" PROUT
${
libstdcpp
}
"
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-include
${
CMAKE_BINARY_DIR
}
/glibc.h -rdynamic -static-libgcc"
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-include
${
CMAKE_BINARY_DIR
}
/glibc.h
-flto
-rdynamic -static-libgcc"
)
target_link_libraries
(
spell-marker
${
libstdcpp
}
${
CMAKE_BINARY_DIR
}
/libgmp.a
)
target_link_libraries
(
spell-qtl
${
libstdcpp
}
)
...
...
@@ -147,11 +147,14 @@ else()
add_executable
(
spell-pedigree
${
SPELL_PEDIGREE_SRC
}
)
add_executable
(
spell-marker
${
SPELL_MARKER_SRC
}
)
add_executable
(
spell-qtl
${
SPELL_QTL_SRC
}
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-rdynamic"
)
SET_SOURCE_FILES_PROPERTIES
(
${
SPELL_PEDIGREE_SRC
}
${
SPELL_MARKER_SRC
}
${
SPELL_QTL_SRC
}
PROPERTIES
COMPILE_FLAGS
"-flto -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-flto -rdynamic"
)
endif
()
target_link_libraries
(
spell-marker dl gmp
)
target_link_libraries
(
spell-qtl
expat
dl rt
)
target_link_libraries
(
spell-qtl dl rt
)
SET
(
EXECUTABLE_OUTPUT_PATH
${
PROJECT_BINARY_DIR
}
/bin
)
...
...
include/excel.h
0 → 100644
View file @
6304b230
/* Spell-QTL Software suite for the QTL analysis of modern datasets.
* Copyright (C) 2016,2017 Damien Leroux <damien.leroux@inra.fr>, Sylvain Jasson <sylvain.jasson@inra.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SPELL_EXCEL_STREAM_H
#define SPELL_EXCEL_STREAM_H
#include
<xlnt/xlnt.hpp>
#include
<iostream>
namespace
excel
{
typedef
std
::
vector
<
std
::
pair
<
std
::
string
,
xlnt
::
font
>>
rich_text
;
struct
stream
{
xlnt
::
workbook
*
bookptr
;
xlnt
::
worksheet
sheet
;
xlnt
::
cell_reference
origin
;
xlnt
::
cell_reference
cursor
;
stream
(
xlnt
::
workbook
*
ptr
)
:
bookptr
(
ptr
),
sheet
(
ptr
->
sheet_by_index
(
0
)),
origin
(
"A1"
),
cursor
(
"A1"
)
{}
void
anchor
(
int
r
,
int
c
)
{
}
xlnt
::
cell
current_cell
()
{
return
sheet
[
cursor
];
}
};
inline
std
::
function
<
void
(
stream
&
)
>
new_worksheet
(
std
::
string
name
)
{
return
[
=
]
(
stream
&
s
)
{
s
.
bookptr
->
create_sheet
().
title
(
name
);
};
}
inline
std
::
function
<
void
(
stream
&
)
>
select_worksheet
(
std
::
string
name
)
{
return
[
=
]
(
stream
&
s
)
{
s
.
sheet
=
s
.
bookptr
->
sheet_by_title
(
name
);
};
}
inline
std
::
function
<
void
(
stream
&
)
>
rename_worksheet
(
std
::
string
name
)
{
return
[
=
]
(
stream
&
s
)
{
s
.
sheet
.
title
(
name
);
};
}
inline
std
::
function
<
void
(
stream
&
)
>
move
(
std
::
string
ref
)
{
return
[
=
]
(
stream
&
s
)
{
s
.
origin
=
s
.
cursor
=
xlnt
::
cell_reference
(
ref
);
};
}
inline
std
::
function
<
void
(
stream
&
)
>
move
(
int
row
,
int
col
)
{
return
[
=
]
(
stream
&
s
)
{
s
.
origin
=
xlnt
::
cell_reference
(
"A1"
).
make_offset
(
col
-
1
,
row
-
1
);
s
.
cursor
=
s
.
origin
;
};
}
inline
std
::
function
<
void
(
stream
&
)
>
next_col
()
{
return
[]
(
stream
&
s
)
{
if
(
s
.
sheet
[
s
.
cursor
].
is_merged
())
{
int
ofs
=
1
;
for
(
const
auto
&
mrange
:
s
.
sheet
.
merged_ranges
())
{
xlnt
::
range
r
(
s
.
sheet
,
mrange
,
xlnt
::
major_order
::
column
,
false
);
if
(
r
.
contains
(
s
.
cursor
))
{
s
.
cursor
=
mrange
.
top_right
().
make_offset
(
1
,
0
);
return
;
}
}
}
else
{
s
.
cursor
=
s
.
cursor
.
make_offset
(
1
,
0
);
}
};
}
inline
std
::
function
<
void
(
stream
&
)
>
next_row
()
{
return
[]
(
stream
&
s
)
{
xlnt
::
cell_reference
linestart
(
s
.
origin
.
column
(),
s
.
cursor
.
row
());
if
(
s
.
sheet
[
linestart
].
is_merged
())
{
for
(
const
auto
&
mrange
:
s
.
sheet
.
merged_ranges
())
{
xlnt
::
range
r
(
s
.
sheet
,
mrange
,
xlnt
::
major_order
::
column
,
false
);
if
(
r
.
contains
(
linestart
))
{
s
.
cursor
=
mrange
.
bottom_left
().
make_offset
(
0
,
1
);
return
;
}
}
}
else
{
s
.
cursor
=
linestart
.
make_offset
(
0
,
1
);
}
};
}
inline
std
::
function
<
void
(
stream
&
)
>
merge
(
int
width
,
int
height
)
{
return
[
=
]
(
stream
&
s
)
{
s
.
sheet
.
merge_cells
((
s
.
cursor
,
s
.
cursor
.
make_offset
(
width
-
1
,
height
-
1
)));
};
}
inline
std
::
function
<
void
(
stream
&
)
>
apply_style
(
std
::
string
name
)
{
return
[
=
]
(
stream
&
s
)
{
s
.
sheet
[
s
.
cursor
].
style
(
name
);
};
}
inline
std
::
function
<
void
(
stream
&
)
>
create_style
(
std
::
string
name
,
std
::
function
<
void
(
xlnt
::
style
&
)
>
init
)
{
return
[
=
]
(
stream
&
s
)
{
auto
style
=
s
.
bookptr
->
create_style
(
name
);
init
(
style
);
};
}
}
inline
excel
::
stream
&
operator
<<
(
excel
::
stream
&
s
,
std
::
function
<
void
(
excel
::
stream
&
)
>
f
)
{
f
(
s
);
return
s
;
}
inline
excel
::
stream
&
operator
<<
(
excel
::
stream
&
s
,
std
::
string
v
)
{
s
.
sheet
[
s
.
cursor
].
value
(
v
,
true
);
return
s
;
}
template
<
typename
V
>
excel
::
stream
&
operator
<<
(
excel
::
stream
&
s
,
V
&&
v
)
{
s
.
sheet
[
s
.
cursor
].
value
(
v
);
return
s
;
}
template
<
typename
V
>
excel
::
stream
&
operator
<<
(
excel
::
stream
&
s
,
const
V
&
v
)
{
s
.
sheet
[
s
.
cursor
].
value
(
v
);
return
s
;
}
#endif
include/model/model.h
View file @
6304b230
...
...
@@ -26,7 +26,7 @@
#include
"beta_gamma.h"
#include
<cmath>
#include
<numeric>
#include
"labelled_matrix.h"
#include
"settings.h"
...
...
sandbox/excel.cc
0 → 100644
View file @
6304b230
#include
"excel.h"
int
main
(
int
argc
,
char
**
argv
)
{
xlnt
::
workbook
wb
;
excel
::
stream
s
(
&
wb
);
s
<<
excel
::
move
(
2
,
2
)
<<
"Toto"
<<
excel
::
next_col
()
<<
42
<<
excel
::
next_row
()
<<
"12/12/2012"
;
s
<<
excel
::
move
(
5
,
1
)
<<
excel
::
merge
(
3
,
2
)
<<
"MERGED"
<<
excel
::
next_col
()
<<
1
<<
excel
::
next_col
()
<<
2
<<
excel
::
next_col
()
<<
3
<<
excel
::
next_row
()
<<
"Pouet ! ! !"
<<
excel
::
next_col
()
<<
23.
;
;
wb
.
save
(
"prout.xlsx"
);
return
0
;
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment