Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:30

0001 /*
0002  * Copyright (c) 2019 Opticks Team. All Rights Reserved.
0003  *
0004  * This file is part of Opticks
0005  * (see https://bitbucket.org/simoncblyth/opticks).
0006  *
0007  * Licensed under the Apache License, Version 2.0 (the "License"); 
0008  * you may not use this file except in compliance with the License.  
0009  * You may obtain a copy of the License at
0010  *
0011  *   http://www.apache.org/licenses/LICENSE-2.0
0012  *
0013  * Unless required by applicable law or agreed to in writing, software 
0014  * distributed under the License is distributed on an "AS IS" BASIS, 
0015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
0016  * See the License for the specific language governing permissions and 
0017  * limitations under the License.
0018  */
0019 
0020 #pragma once
0021 
0022 #include <vector>
0023 #include <string>
0024 #include <sstream>
0025 #include <iostream>
0026 #include <iomanip>
0027 #include <iterator>
0028 #include <algorithm>
0029 #include <cstring>
0030 
0031 #include "plog/Severity.h"
0032 
0033 /**
0034 struct SArgs
0035 ==============
0036 
0037 Allows combining standard arguments with arguments 
0038 from a split string.
0039 
0040 TODO: Why is this implemented in the header ? Was is for some logging reason ?
0041       Investigate and fix as it forces recompilation of  everything following changes.
0042 
0043 
0044 **/
0045 
0046 #include "SYSRAP_API_EXPORT.hh"
0047 
0048 struct SYSRAP_API SArgs
0049 {
0050     static const plog::Severity LEVEL ; 
0051 
0052     int argc ;
0053     char** argv ; 
0054 
0055     std::vector<std::string> elem ; 
0056     void add(int argc_, char** argv_);
0057 
0058     static bool starts_with( const std::string& e, const char* pfx );
0059     void addElements(const std::string& line, bool dedupe);
0060     void make();
0061 
0062     std::string desc() const ; 
0063     void dump() const ;
0064 
0065     SArgs(int argc_, char** argv_, const char* argforced, const char* opts, bool dedupe=true);
0066     SArgs(const char* argv0, const char* argline);
0067     bool hasArg(const char* arg) const ;
0068     std::string getArgLine() const ; 
0069     const char* get_arg_after(const char* option, const char* fallback) const ; 
0070     const char* get_first_arg_ending_with(const char* ending, const char* fallback) const ; 
0071 
0072 };
0073