#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
Go to the source code of this file.
|
template<typename T > |
std::ostream & | operator<< (std::ostream &s, std::vector< T > &v) |
|
void | replace (std::vector< std::string > b, int position, const std::string ®ex, const std::string &pattern) |
|
bool | comparitor (std::vector< std::string > &b) |
|
int | main (int argc, char **argv) |
|
◆ comparitor()
bool comparitor |
( |
std::vector< std::string > & |
b | ) |
|
Definition at line 60 of file selectblock.cxx.
62 for (
size_t i=0 ;
i<
b.size() ;
i++ )
if (
b[
i].
find(
"TIDArun")!=std::string::npos )
return true;
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 67 of file selectblock.cxx.
69 if (
argc<2 )
return -1;
73 std::vector<std::vector<std::string> > block(1,std::vector<std::string>() );
79 std::vector<int> position(1, 0);
85 if (
line.find(
"action")!=std::string::npos ) {
86 if (
line.find(
"/action")==std::string::npos ) {
89 size_t pos =
tmp.find(
"\"");
92 if (
pos!=std::string::npos)
p.resize(
pos );
99 block.push_back(std::vector<std::string>());
100 position.push_back( 0 );
106 block[iblock].push_back(
line);
109 if (
line.find(
"/action")!=std::string::npos ) {
112 block.push_back(std::vector<std::string>());
113 position.push_back( 0 );
123 for (
size_t i=0 ;
i<block.size() ;
i++ ) {
124 if (
comparitor(block[
i]) && position[
i]>position[maxblock] ) maxblock =
i;
129 for (
size_t i=0 ;
i<block.size() ;
i++ )
if ( position[
i]>0 ) lastblock =
i;
133 for (
size_t i=0 ;
i<=lastblock ;
i++ ) {
134 if ( !
comparitor( block[
i] ) ) std::cout << block[
i] << std::endl;
137 int nblock = position[maxblock]+1;
145 for (
size_t i=lastblock+1 ;
i<block.size() ;
i++ ) std::cout << block[
i] << std::endl;
◆ operator<<()
template<typename T >
std::ostream& operator<< |
( |
std::ostream & |
s, |
|
|
std::vector< T > & |
v |
|
) |
| |
◆ replace()
void replace |
( |
std::vector< std::string > |
b, |
|
|
int |
position, |
|
|
const std::string & |
regex, |
|
|
const std::string & |
pattern |
|
) |
| |
Definition at line 21 of file selectblock.cxx.
22 for (
int i=0 ;
i<
b.size() ;
i++ ) {
24 size_t p0 =
b[
i].find(
"position=" );
28 if (
p0!=std::string::npos ) {
31 sprintf( nl,
b[
i].substr( 0,
p0 ).c_str() );
34 ns+=
"position=\"%02d\">";
36 sprintf( nl,
ns.c_str(), position );
45 if (
p!=std::string::npos ) {
51 if (
newline.find(
"-plots")!=std::string::npos ) {
55 std::cout <<
newline << std::endl;