66 #include <wx/tokenzr.h>
79 int firstPos = 0,
size = 0;
80 for (
unsigned int i=0;
i<inStr.size(); ++
i) {
81 if (inStr[
i] ==
'\n') {
82 outList->resize(outList->size() + 1);
83 outList->back() = inStr.substr(firstPos,
size);
87 }
else if (
i == inStr.size() - 1) {
88 ERRORMSG(
"SplitString() - input multi-line string doesn't end with \n!");
95 #define SPLIT_DATAIN_INTO_LINES \
97 SplitString(dataIn, &lines); \
98 list<string>::const_iterator l, le = lines.end()
103 if (dataIn.size() > 0)
104 TRACEMSG(
"data:\n" << dataIn.substr(0, dataIn.size() - 1));
119 if (dataIn.size() == 0) {
131 for (
l=lines.begin();
l!=
le; ++
l) {
133 vector < string > toks;
136 if (toks.size() != 2) {
137 ADD_REPLY_ERROR(
string(
"invalid line, expected 'id' + tab + 'ranges': ") + *
l);
145 list < CRef < CSeq_id > > idList;
151 seq = structureWindow->glCanvas->structureSet->sequenceSet->FindMatchingSequence(idList);
158 wxStringTokenizer tkz(toks[1].c_str(),
", ", wxTOKEN_STRTOK);
159 while (tkz.HasMoreTokens()) {
160 wxString
range = tkz.GetNextToken();
161 wxStringTokenizer rangeToks(
range,
"-", wxTOKEN_RET_EMPTY);
162 if (rangeToks.CountTokens() < 1 || rangeToks.CountTokens() > 2) {
166 unsigned long from, to;
168 if (rangeToks.CountTokens() == 1) {
169 okay = rangeToks.GetNextToken().ToULong(&from);
172 okay = (rangeToks.GetNextToken().ToULong(&from) && rangeToks.GetNextToken().ToULong(&to));
174 if (!okay || from >= seq->
Length() || to >= seq->
Length() || from > to) {
185 INFOMSG(
"Cached incoming highlights");
191 if (dataIn.size() == 0) {
201 if (structureWindow->glCanvas->structureSet) {
203 structureWindow->SaveDialog(
true,
false);
206 wxString stripped(wxString(dataIn.c_str()).Strip(wxString::both));
207 if (!structureWindow->LoadData(stripped.c_str(),
true,
false))
void ProcessCommand(const std::string &command, const std::string &dataIn, ncbi::MessageResponder::ReplyStatus *status, std::string *dataOut)
void SequenceWindowsSave(bool prompt)
bool RemoveAllHighlights(bool postRedraws)
void AddHighlights(const Sequence *sequence, unsigned int seqIndexFrom, unsigned int seqIndexTo)
void CacheHighlights(void)
unsigned int Length(void) const
#define SPLIT_DATAIN_INTO_LINES
static void SplitString(const string &inStr, list< string > *outList)
Include a standard set of the NCBI C++ Toolkit most basic headers.
bool IdentifierToSeqId(const string &identifier, CRef< ncbi::objects::CSeq_id > &seqID)
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static string LoadFile(CNcbiIstream &str)
Messenger * GlobalMessenger(void)
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
bool le(T x_, T y_, T round_)
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
#define IMPLEMENT_COMMAND_FUNCTION(name)
#define PROCESS_IF_COMMAND_IS(name)
#define ADD_REPLY_ERROR(msg)