g4tools  5.4.0
paper_format
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_paper_format
5 #define tools_paper_format
6 
7 #include "path"
8 #include "touplow"
9 
10 namespace tools {
11 namespace file {
12 
13 // file::paper_format_extension() is in file_format.
14 // related files : sg/write_paper.
15 
16 inline bool extension_paper_format(const std::string& a_file,std::string& a_fmt) {
17  std::string path,name,suffix;
18  if(!path_name_suffix(a_file,path,name,suffix)) {a_fmt.clear();return false;}
20  if((suffix=="ps")||(suffix=="eps")) {
21  a_fmt = "inzb_ps";
22  return true;
23  } else if(suffix=="png") {
24  a_fmt = "inzb_png";
25  return true;
26  } else if((suffix=="jpg")||(suffix=="jpeg")) {
27  a_fmt = "inzb_jpeg";
28  return true;
29 
30  } else if(suffix=="pdf") {
31  a_fmt = "gl2ps_pdf";
32  return true;
33  } else if(suffix=="svg") {
34  a_fmt = "gl2ps_svg";
35  return true;
36  } else if(suffix=="pgf") {
37  a_fmt = "gl2ps_pgf";
38  return true;
39  } else if(suffix=="tex") {
40  a_fmt = "gl2ps_tex";
41  return true;
42  }
43  a_fmt.clear();
44  return false;
45 }
46 
47 }}
48 
49 #endif
50 
touplow
tools::tolowercase
void tolowercase(std::string &a_string)
Definition: touplow:11
tools::suffix
void suffix(const std::string &a_string, std::string &a_value, bool a_back=true)
Definition: path:11
path
tools::path_name_suffix
bool path_name_suffix(const std::string &a_string, std::string &a_path, std::string &a_name, std::string &a_suffix)
Definition: path:115
tools::file::extension_paper_format
bool extension_paper_format(const std::string &a_file, std::string &a_fmt)
Definition: paper_format:16
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26