diff --git a/src/DirectoryMetadata.cpp b/src/DirectoryMetadata.cpp index 29cc381..efd62db 100644 --- a/src/DirectoryMetadata.cpp +++ b/src/DirectoryMetadata.cpp @@ -1,3 +1,19 @@ +/* + Copyright (C) 2011 Michael Schuerig + + This program 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. + + This program 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 this program. If not, see . +*/ #include "DirectoryMetadata.h" diff --git a/src/DirectoryMetadata.h b/src/DirectoryMetadata.h index 0b5fd51..4dbb17d 100644 --- a/src/DirectoryMetadata.h +++ b/src/DirectoryMetadata.h @@ -1,6 +1,22 @@ +/* + Copyright (C) 2011 Michael Schuerig -#ifndef DIRECTORY_METADATA_H_INCLUDED_ -#define DIRECTORY_METADATA_H_INCLUDED_ + This program 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. + + This program 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 this program. If not, see . +*/ + +#ifndef DIRECTORYMETADATA_H +#define DIRECTORYMETADATA_H #include "NameShortener.h" @@ -76,4 +92,4 @@ class DirectoryMetadata : public boost::noncopyable { const boost::shared_ptr etc_; }; -#endif // DIRECTORY_METADATA_H_INCLUDED_ +#endif // DIRECTORYMETADATA_H diff --git a/src/Etc.cpp b/src/Etc.cpp index a6e4dfc..97e4113 100644 --- a/src/Etc.cpp +++ b/src/Etc.cpp @@ -1,3 +1,19 @@ +/* + Copyright (C) 2011 Michael Schuerig + + This program 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. + + This program 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 this program. If not, see . +*/ #include "Etc.h" diff --git a/src/Etc.h b/src/Etc.h index b99e240..bab47e7 100644 --- a/src/Etc.h +++ b/src/Etc.h @@ -1,6 +1,22 @@ +/* + Copyright (C) 2011 Michael Schuerig -#ifndef ETC_H_INCLUDED -#define ETC_H_INCLUDED + This program 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. + + This program 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 this program. If not, see . +*/ + +#ifndef ETC_H +#define ETC_H #include #include @@ -19,4 +35,4 @@ class Etc : public boost::noncopyable { gid_t lookupGroupId(const std::string& group) const; }; -#endif // ETC_H_INCLUDED +#endif // ETC_H diff --git a/src/IdentityShortener.h b/src/IdentityShortener.h index fcb3a1f..e116246 100644 --- a/src/IdentityShortener.h +++ b/src/IdentityShortener.h @@ -1,6 +1,22 @@ +/* + Copyright (C) 2011 Michael Schuerig -#ifndef IDENTITY_SHORTENER_H_INCLUDED_ -#define IDENTITY_SHORTENER_H_INCLUDED_ + This program 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. + + This program 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 this program. If not, see . +*/ + +#ifndef IDENTITYSHORTENER_H +#define IDENTITYSHORTENER_H #include "NameShortener.h" #include @@ -13,4 +29,4 @@ class IdentityShortener : public NameShortener } }; -#endif // IDENTITY_SHORTENER_H_INCLUDED_ +#endif // IDENTITYSHORTENER_H diff --git a/src/MD5Shortener.cpp b/src/MD5Shortener.cpp index 4b31336..4a82797 100644 --- a/src/MD5Shortener.cpp +++ b/src/MD5Shortener.cpp @@ -1,3 +1,19 @@ +/* + Copyright (C) 2011 Michael Schuerig + + This program 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. + + This program 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 this program. If not, see . +*/ #include "MD5Shortener.h" diff --git a/src/MD5Shortener.h b/src/MD5Shortener.h index c1a0801..416ffa6 100644 --- a/src/MD5Shortener.h +++ b/src/MD5Shortener.h @@ -1,6 +1,22 @@ +/* + Copyright (C) 2011 Michael Schuerig -#ifndef MD5_SHORTENER_INCLUDED_H_ -#define MD5_SHORTENER_INCLUDED_H_ + This program 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. + + This program 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 this program. If not, see . +*/ + +#ifndef MD5SHORTENER_H +#define MD5SHORTENER_H #include "NameShortener.h" #include @@ -10,5 +26,4 @@ class MD5Shortener : public NameShortener { virtual std::string shorten(const std::string& longName); }; -#endif // MD5_SHORTENER_INCLUDED_H_ - +#endif // MD5SHORTENER_H diff --git a/src/NameShortener.h b/src/NameShortener.h index 96dfc9c..50f5202 100644 --- a/src/NameShortener.h +++ b/src/NameShortener.h @@ -1,6 +1,22 @@ +/* + Copyright (C) 2011 Michael Schuerig -#ifndef NAME_SHORTENER_INCLUDED_H_ -#define NAME_SHORTENER_INCLUDED_H_ + This program 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. + + This program 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 this program. If not, see . +*/ + +#ifndef NAMESHORTENER_H +#define NAMESHORTENER_H #include @@ -22,4 +38,4 @@ class NameShortener { virtual void doReset() {} }; -#endif // NAME_SHORTENER_INCLUDED_H_ +#endif // NAMESHORTENER_H diff --git a/src/TruncatingShortener.cpp b/src/TruncatingShortener.cpp index 6f52d35..cec3476 100644 --- a/src/TruncatingShortener.cpp +++ b/src/TruncatingShortener.cpp @@ -1,3 +1,19 @@ +/* + Copyright (C) 2011 Michael Schuerig + + This program 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. + + This program 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 this program. If not, see . +*/ #include "TruncatingShortener.h" #include diff --git a/src/TruncatingShortener.h b/src/TruncatingShortener.h index a29106c..501b748 100644 --- a/src/TruncatingShortener.h +++ b/src/TruncatingShortener.h @@ -1,6 +1,22 @@ +/* + Copyright (C) 2011 Michael Schuerig -#ifndef TRUNCATING_SHORTENER_INCLUDED_H_ -#define TRUNCATING_SHORTENER_INCLUDED_H_ + This program 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. + + This program 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 this program. If not, see . +*/ + +#ifndef TRUNCATINGSHORTENER_H +#define TRUNCATINGSHORTENER_H #include "NameShortener.h" #include @@ -18,6 +34,4 @@ class TruncatingShortener : public NameShortener { virtual void reset(); }; -#endif // TRUNCATING_SHORTENER_INCLUDED_H_ - - +#endif // TRUNCATINGSHORTENER_H diff --git a/src/algorithm.h b/src/algorithm.h index 9cd23c7..8861208 100644 --- a/src/algorithm.h +++ b/src/algorithm.h @@ -1,6 +1,22 @@ +/* + Copyright (C) 2011 Michael Schuerig -#ifndef ALGORITHM_H_INCLUDED_ -#define ALGORITHM_H_INCLUDED_ + This program 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. + + This program 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 this program. If not, see . +*/ + +#ifndef ALGORITHM_H +#define ALGORITHM_H #include @@ -22,4 +38,4 @@ index_by(const T& t, R T::value_type::*ptr_to_mem) } // namespace algorithm -#endif // ALGORITHM_H_INCLUDED_ +#endif // ALGORITHM_H diff --git a/src/dirmeta.cpp b/src/dirmeta.cpp index 693fca9..247ee46 100644 --- a/src/dirmeta.cpp +++ b/src/dirmeta.cpp @@ -1,3 +1,19 @@ +/* + Copyright (C) 2011 Michael Schuerig + + This program 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. + + This program 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 this program. If not, see . +*/ #include #include "DirectoryMetadata.h" diff --git a/src/exception.cpp b/src/exception.cpp index 387a62f..c9838c9 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -1,3 +1,19 @@ +/* + Copyright (C) 2011 Michael Schuerig + + This program 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. + + This program 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 this program. If not, see . +*/ #include "exception.h" #include diff --git a/src/exception.h b/src/exception.h index dfcf8e5..8856b2a 100644 --- a/src/exception.h +++ b/src/exception.h @@ -1,6 +1,22 @@ +/* + Copyright (C) 2011 Michael Schuerig -#ifndef EXCEPTION_H_INCLUDED_ -#define EXCEPTION_H_INCLUDED_ + This program 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. + + This program 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 this program. If not, see . +*/ + +#ifndef EXCEPTION_H +#define EXCEPTION_H #include #include @@ -49,4 +65,4 @@ class CatchAll : protected CatchAllBase { } // namespace exception -#endif // EXCEPTION_H_INCLUDED_ +#endif // EXCEPTION_H diff --git a/src/transpath.cpp b/src/transpath.cpp index 7e59bbe..e5e9fad 100644 --- a/src/transpath.cpp +++ b/src/transpath.cpp @@ -1,3 +1,19 @@ +/* + Copyright (C) 2011 Michael Schuerig + + This program 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. + + This program 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 this program. If not, see . +*/ #include "DirectoryMetadata.h" #include "TruncatingShortener.h" @@ -37,31 +53,31 @@ translate( const string& longPath, NameShortener& shortener) { DirectoryMetadata::Ptr dm; foreach( fs::path part, path ) { - if ( fs::is_directory(prefixPath) ) { - shortener.reset(); - dm = DirectoryMetadata::fromFilesystem(prefixPath.string(), shortener); - } else { - BOOST_THROW_EXCEPTION( - PathTranslationError() - << boost::errinfo_file_name(prefixPath.string()) - << boost::errinfo_errno(ENOTDIR) - ); - } - - EntryMap entryMap = algorithm::index_by(*dm, &DirectoryMetadata::Entry::longName); - - EntryMap::const_iterator ep( entryMap.find(part.string()) ); - if ( ep != entryMap.end() ) { - resultPath /= ep->second.shortName; - } else { - BOOST_THROW_EXCEPTION( - PathTranslationError() - << boost::errinfo_file_name(part.string()) - << boost::errinfo_errno(ENOENT) - ); - } - - prefixPath /= part; + if ( fs::is_directory(prefixPath) ) { + shortener.reset(); + dm = DirectoryMetadata::fromFilesystem(prefixPath.string(), shortener); + } else { + BOOST_THROW_EXCEPTION( + PathTranslationError() + << boost::errinfo_file_name(prefixPath.string()) + << boost::errinfo_errno(ENOTDIR) + ); + } + + EntryMap entryMap = algorithm::index_by(*dm, &DirectoryMetadata::Entry::longName); + + EntryMap::const_iterator ep( entryMap.find(part.string()) ); + if ( ep != entryMap.end() ) { + resultPath /= ep->second.shortName; + } else { + BOOST_THROW_EXCEPTION( + PathTranslationError() + << boost::errinfo_file_name(part.string()) + << boost::errinfo_errno(ENOENT) + ); + } + + prefixPath /= part; } return resultPath.string(); }