/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . Application Test-List Description Simple tests and examples of use of List See also Foam::List \*---------------------------------------------------------------------------*/ #include "OSspecific.H" #include "argList.H" #include "wordRes.H" #include "IOstreams.H" #include "StringStream.H" #include "scalar.H" #include "vector.H" #include "labelRange.H" #include "scalarList.H" #include "HashOps.H" #include "ListOps.H" #include "SubList.H" #include "ListPolicy.H" #include #include #include namespace Foam { // Verify inheritance class MyStrings : public List { public: using List::List; }; namespace Detail { namespace ListPolicy { // Override on a per-type basis template<> struct short_length : std::integral_constant {}; } // End namespace ListPolicy } // End namespace Detail } // End namespace Foam using namespace Foam; template void testFind(const T& val, const ListType& lst) { Info<< nl << "Search for "<< val << " in " << flatOutput(lst) << nl <<" found() = " << lst.found(val) <<" find() = " << lst.find(val) <<" rfind() = " << lst.rfind(val) <<" find(2) = " << lst.find(val, 2) <<" rfind(2) = " << lst.rfind(val, 2) << nl << nl; } void printMyString(const UList& lst) { MyStrings slist2(lst); Info< Ostream& printListOutputType(const char* what) { Info<< what << " (contiguous=" << contiguous() << " no_linebreak=" << Detail::ListPolicy::no_linebreak::value << " short_length=" << Detail::ListPolicy::short_length::value << ')'; return Info; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: int main(int argc, char *argv[]) { argList::noParallel(); argList::noFunctionObjects(); argList::addOption("reList", "reList"); argList::addOption("wordList", "wordList"); argList::addOption("stringList", "stringList"); argList::addOption("float", "xx"); argList::addBoolOption("create", "Test ListOps::create functionality"); argList::addBoolOption("ListList", "Test list of list functionality"); argList::addBoolOption("flag"); #include "setRootCase.H" { List