Commit Graph

64 Commits

Author SHA1 Message Date
23dd3e072b ENH: provide for writing contents only from dictionary entries 2011-02-23 13:02:36 +01:00
71d21f6de4 ENH: implement stringOps - trim, trimRight, inplaceTrim, inplaceTrimRight 2011-02-23 10:13:10 +01:00
ba873744f3 ENH: add stringOps namespace with a collection of string-related ops 2011-02-22 10:20:55 +01:00
5538eb4f95 ENH: #codeStream : new functionEntry 2011-02-21 10:13:01 +00:00
596430d35d ENH: string: allow empty string substitution in expand 2011-02-18 18:08:05 +00:00
c3cb632c24 Documentation: converted javadoc @ to LaTeX style \ in Doxygen code docs 2011-02-08 18:22:00 +00:00
e3b9d3b6a4 STYLE: organize primitives/Lists into their respective subdirs 2011-01-31 12:47:49 +01:00
eaef8d482b STYLE: Updated 1991 start copyright year to 2004 2011-01-14 16:08:00 +00:00
099cc39e2e Revert "STYLE: 2011 copyright date."
This reverts commit b18f6cc1ce.
2011-01-05 18:24:29 +00:00
b18f6cc1ce STYLE: 2011 copyright date. 2011-01-05 11:14:26 +00:00
283f4fab77 ENH: string : recursive variable substitution 2010-12-19 18:30:52 +00:00
1a0da12db3 STYLE: avoid copy operation in fileName::isAbsolute() 2010-11-10 09:57:22 +01:00
64fe671850 ENH: Added isAbsolute() function to fileName class 2010-11-02 18:06:27 +00:00
850fa066d3 ENH: add UList typedefs for the various List counterparts
- eg,
    labelUList  <-> labelList
    scalarUList <-> scalarList
    ...

Note the unallocLabelList typedef is still available.
However labelUList requires less typing (10 vs. 17 chars) and has a
more obvious to labelList.
2010-10-13 10:43:16 +02:00
b89a3dc2c0 ENH: add keyType::null and wordRe::null, add match method to string classes
- provides a more uniform interface to string list operations etc

STYLE: more complete docs for keyType
2010-08-04 10:35:16 +02:00
d79237597e STYLE: Fixing code style requirements for all src. 2010-07-28 13:31:46 +01:00
c508b2fe17 STYLE: consistent capitalization of Private/Protected Member Functions in comments 2010-03-30 11:33:42 +02:00
d29c438657 STYLE: use url for FSF license instead of postal address, switch to GPL v3 2010-03-29 14:07:56 +02:00
a562969196 STYLE: use more efficient ++iterator instead of iterator++ in string class. 2010-02-03 17:44:35 +01:00
1b0cf102cc testing on fileName Istream construction 2009-12-04 16:22:59 +01:00
c45ea2c4f1 reworked stringListOps to improve the flexibility
- added subsetStrings and inplaceSubsetString

- added class wordReListMatcher to wrap a match() for a UList<wordRe>
2009-10-08 11:32:26 +02:00
77b2fecc7f check for empty word/expression in keyType and wordRe IO 2009-08-09 09:58:00 +02:00
a3cd621b53 update docs for fileName, word, wordRe 2009-08-06 08:42:08 +02:00
35986a3972 implement fileName::clean() method
* remove repeated slashes
      /abc////def        -->   /abc/def

* remove '/./'
      /abc/def/./ghi/.   -->   /abc/def/./ghi
      abc/def/./         -->   abc/def

* remove '/../'
      /abc/def/../ghi/jkl/nmo/..   -->   /abc/ghi/jkl
      abc/../def/ghi/../jkl        -->   abc/../def/jkl

* remove trailing '/'
2009-07-25 20:40:52 +02:00
ab918fba9b introduce fileName::clean() method
- still needs more fleshing out, but introduce the method for now and
  add more code later (without recompiling everything else).
2009-07-23 23:53:32 +02:00
eb3c47c75f pass-thru object in assignment of primitive types (strings) 2009-03-12 11:29:39 +01:00
b968e62ef9 objectRegistry fixes
- objectRegistry gets a rename() that also adjusts the dbDir
- cloud reworked to use static variables subInstance and defaultName.
  This avoids writing "lagrangian" everywhere

string fixes
- avoid masking of std::string::replace in string.H
- avoid old strstream in PV3FoamReader
2009-03-06 15:18:00 +01:00
17548296be Switched from old hashing functions to use Bob Jenkins' hash routine
- If the underlying type is contiguous, FixedList hashes its storage directly.
- Drop labelPairHash (non-commutative) from fvMeshDistribute since
  FixedList::Hash does the right thing anyhow.
- Hash<edge> specialization is commutative, without multiplication.
- Hash<triFace> specialization kept multiplication (but now uLabel).
  There's not much point optimizing it, since it's not used much anyhow.

Misc. changes

- added StaticAssert to NamedEnum.H
- label.H / uLabel.H : define FOAM_LABEL_MAX, FOAM_ULABEL_MAX with the
  values finally used for the storage.  These can be useful for pre-processor
  checks elsewhere (although I stopped needing them in the meantime).
2009-03-04 10:50:14 +01:00
576d9388f0 Preliminary work on hashing
- Hash returns unsigned
- FixedList templated on unsigned int
- include uLabel.H in UList, HashTable etc. so the output function is know
  throughout
2009-02-27 12:40:37 +01:00
a46c85f5a4 HashTable changes
- make table power-of-two, but since it seems to give 1-2% performance
  improvement, maybe forget it too.

- remove two-argument form of hashing classes and do the modulus direclty
  within HashTable instead. This simplifies things a fair bit.

- migrate Hash<void*> from db/dlLibrary to primitives/hashes/Hash
2009-02-26 17:49:47 +01:00
2aeee852e8 PackedList bugfix, HashTable tweak
- it was possible to create a PackedList::iterator from a
  PackedList::const_iterator and violate const-ness

- added HashTable::printInfo for emitting some information

- changed default table sizes from 100 -> 128 in preparation for future
  2^n table sizes
2009-02-26 15:32:47 +01:00
ffd9bb08a8 OSspecific: altered file tests
- removed the previously added fileName type(), isDir(), isFile() methods.

- added optional bool parameter to isFile() function to explicitly
  enable/disable the check for gzip files.

- fixed minor bugginess where the default usage of isFile() would result in
  false positive matches.

- be slightly more stringent and use isDir() and isFile() instead of
  exists() function when we actually know the expected type.
2009-02-06 10:25:41 +01:00
e5c5829244 OSspecific: isDir(), isFile() instead of dir(), file() 2009-02-02 16:50:18 +01:00
fe6a83a3a8 moved fileName::IOobjectComponents -> IOobject::fileNameComponents 2009-01-30 09:06:47 +01:00
defe13e205 fileName gets additional convenience methods
- exists() = forward to OSspecific exists(...)
- isDir()  = forward to OSspecific dir(...)
- isFile() = forward to OSspecific file(...)
- IOobjectComponents() - split into instance, local, name following rules
  set out for IOobject.

- added IOobject(path, registry, ...) constructor that uses
  fileName::IOobjectComponents(). This hides the complexity we otherwise need.
2009-01-27 13:28:45 +01:00
9087cd7b8e Support for single-quoted strings
- token class handles both single and double quoted strings. Single quoted
  strings are used to tag regular expressions. At the moment this is just
  syntactical sugar and isn't (yet) treated differently than double-quoted
  strings.

- write output for std:string, with/without single quotes with the method
  writeQuoted(). Use distinct method name to avoid inadvertent compiler
  conversions.

- write wordRe and keyType using writeQuoted()
2009-01-19 11:33:37 +01:00
3adf0f5c8e minor cleanup for reverted string changes (commit 4f5f66e759)
- put back debug switch (even although it is never used)
- remove stringsGlobals.C, since it is now never used
2009-01-16 12:27:03 +01:00
4395170915 Put back
static const char* const typeName;
        static int debug;

which had disappeared.
2009-01-15 16:57:01 +00:00
bd04dc7b59 Some stuff 2009-01-15 16:45:44 +00:00
4f5f66e759 Reverted change concerning the location of the construction of the "null" strings.
Changed dotFoam function to use null-constructed strings rather that the "null" strings.
2009-01-15 16:41:08 +00:00
95dcb6ded7 Simplify checking of container (List/HashTable, strings) sizes
- can use 'XX.empty()' instead of 'XX.size() == 0', 'XX.size() < 1' or
  'XX.size() <= 0' or for simpler coding.
  It also has the same number of characters as '!XX.size()' and /might/ be
  more readable

- many size checking had 'XX.size() > 0', 'XX.size() != 0', or 'XX.size() >= 1'
  when a simple 'XX.size()' suffices
2009-01-10 20:28:06 +01:00
b85c9a7487 avoided some unneeded conversions of string::npos, minor cleanup of className
- string doesn't use any debug info, remove it
- restructured the macros to add in NoDebug macro versions to className,
  typeInfo.  Might be helpful with tackling the globals bootstrapping issue.
- HashTableName + StaticHashTableName - avoid lookup of debug switch when
  FULLDEBUG is not defined
2009-01-09 15:15:21 +01:00
c5b38a7232 update copyrights for 2009 2008-12-31 19:01:56 +01:00
cdd2266467 Merge commit 'OpenCFD/master' into olesenm
Conflicts:

	src/OpenFOAM/db/IOstreams/Pstreams/IPstream.C
	src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C
2009-01-07 09:39:17 +01:00
3c5852ebfc reworked regExp + wordRe a bit, minor change to keyType
regExp:
- added optional ignoreCase for constructor.
- the compile() methods is now exposed as set(...) method with an optional
  ignoreCase argument.  Not currently much use for the other regex compile
  flags though. The set() method can be used directly instead of the
  operator=() assignment.

keyType + wordRe:
- it's not clear that any particular characters are valid/invalid (compared
  to string or word), so just drop the valid(char) method for now

wordRe:
- a bool doesn't suffice, added enum compOption (compile-option)
- most constructors now have a compOption. In *all* cases it defaults to
  LITERAL - ie, the same behaviour for std::string and Foam::string
- added set(...) methods that do much the same as operator=(...), but the
  compOption can be specified.  In all cases, it defaults to DETECT.

 In Summary
    By default the constructors will generally preserve the argument as
    string literal and the assignment operators will use the wordRe::DETECT
    compOption to scan the string for regular expression meta characters
    and/or invalid word characters and react accordingly.

    The exceptions are when constructing/assigning from another
    Foam::wordRe (preserve the same type) or from a Foam::word (always
    literal).
2009-01-05 17:02:58 +01:00
2717aa5c7d new wordRe class - a word that holds a regExp
- a possible future replacement for keyType, but the immediate use is the
    wordReList for grepping through other lists.
  - note that the argList treatment of '(' ... ')' yields quoted strings,
    which we can use for building a wordReList

minor cleanup of regExp class

  - constructor from std::string, match std::string and
    operator=(std::string&)
    rely on automatic conversion to Foam::string
  - ditch partialMatch with sub-groups, it doesn't make much sense
2009-01-04 00:33:27 +01:00
1d866d7fe8 reworked IOstreams
- Istream and Ostream now retain backslashes when reading/writing strings.
  The previous implementation simply discarded them, except when used to
  escape a double-quote or a newline. It is now vitally important to retain
  them, eg for quoting regular expression meta-characters.

  The backslash continues to be used as an escape character for double-quote
  and newline, but otherwise get passed through "as-is" without any other
  special meaning (ie, they are *NOT* C-style strings). This helps avoid
  'backslash hell'!
  For example,
     string:   "match real dots \.+, question mark \? or any char .*"
     C-style:  "match real dots \\.+, question mark \\? or any char .*"

- combined subfiles in db/IOstreams, some had more copyright info than code
- OPstreamI.H contained only private methods, moved into OPstream.C

Are these really correct?
   IOstreams/Istream.H:#   include "HashTable.C"
   token/token.H:#define NoHashTableC
2009-01-03 12:52:27 +01:00
28b200bcd9 update copyrights for 2009 2008-12-31 19:01:56 +01:00
1089d5a5d5 Moved the construction of the static "null" strings to stringsGlobals.C which is included in global.Cver to avoid inter-dependency problems in the construction of globals.
Patch supplied by Michael Wild, see
http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?126/10442
2008-12-29 18:54:46 +00:00
eb37259958 Changed the "unsigned int" old-style cast to a "unsigned" type conversion to avoid
warning: use of old-style cast
2008-12-29 18:51:40 +00:00