26 #if ! defined (octave_ls_oct_text_h)
27 #define octave_ls_oct_text_h 1
29 #include "octave-config.h"
42 #define CELL_ELT_TAG "<cell-element>"
46 #if ! defined (OCT_RBV)
47 # define OCT_RBV (std::numeric_limits<double>::max () / 100.0)
50 extern OCTINTERP_API std::string
52 const bool next_only =
false);
54 extern OCTINTERP_API std::string
55 read_text_data (std::istream& is,
const std::string& filename,
bool& global,
57 const bool do_name_validation =
true);
59 extern OCTINTERP_API
bool
61 const std::string& name,
bool mark_global,
int precision);
63 extern OCTINTERP_API
bool
65 const std::string& name);
67 extern OCTINTERP_API
bool
69 bool parametric =
false);
81 const bool next_only =
false)
89 if (c ==
'%' || c ==
'#')
91 std::ostringstream buf;
93 while (is.get (c) && (c ==
' ' || c ==
'\t' || c ==
'%' || c ==
'#'))
99 while (is.get (c) && isalpha (c))
102 std::string tmp = buf.str ();
103 bool match = (tmp.substr (0,
strlen (keyword)) == keyword);
107 while (is.get (c) && (c ==
' ' || c ==
'\t' || c ==
':'))
111 if (c !=
'\n' && c !=
'\r')
125 template <
typename T>
128 const bool next_only =
false)
141 template <
typename T>
144 std::string& kw, T& value,
const bool next_only =
false)
153 if (c ==
'%' || c ==
'#')
155 std::ostringstream buf;
157 while (is.get (c) && (c ==
' ' || c ==
'\t' || c ==
'%' || c ==
'#'))
163 while (is.get (c) && isalpha (c))
166 std::string tmp = buf.str ();
168 for (
int i = 0; i < keywords.
numel (); i++)
170 int match = (tmp == keywords[i]);
176 while (is.get (c) && (c ==
' ' || c ==
'\t' || c ==
':'))
180 if (c !=
'\n' && c !=
'\r')
octave_idx_type numel(void) const
void skip_until_newline(std::istream &is, bool keep_newline)
OCTINTERP_API std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only=false)
OCTINTERP_API bool save_text_data_for_plotting(std::ostream &os, const octave_value &t, const std::string &name)
OCTINTERP_API std::string read_text_data(std::istream &is, const std::string &filename, bool &global, octave_value &tc, octave_idx_type count, const bool do_name_validation=true)
OCTINTERP_API bool save_text_data(std::ostream &os, const octave_value &val_arg, const std::string &name, bool mark_global, int precision)
OCTINTERP_API bool save_three_d(std::ostream &os, const octave_value &t, bool parametric=false)
T::size_type strlen(const typename T::value_type *str)