bump product version to 4.1.6.2
[LibreOffice.git] / autodoc / source / exes / adc_uni / cmd_sincedata.cxx
blobd2ebb0db684ac499eed4a84cdc284d1c57e6aac6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <precomp.h>
21 #include "cmd_sincedata.hxx"
24 // NOT FULLY DEFINED SERVICES
25 #include <cosv/file.hxx>
26 #include <cosv/tpl/tpltools.hxx>
27 #include "adc_cmds.hxx"
31 namespace autodoc
33 namespace command
36 SinceTagTransformationData::SinceTagTransformationData()
37 : aTransformationTable()
41 SinceTagTransformationData::~SinceTagTransformationData()
45 bool
46 SinceTagTransformationData::DoesTransform() const
48 return NOT aTransformationTable.empty();
51 const String &
52 SinceTagTransformationData::DisplayOf( const String & i_versionNumber ) const
54 if (DoesTransform())
56 StreamLock
57 sl(200);
58 sl() << i_versionNumber;
59 sl().strip_frontback_whitespace();
60 String
61 sVersionNumber(sl().c_str());
63 const String *
64 ret = csv::find_in_map(aTransformationTable, sVersionNumber);
65 return ret != 0
66 ? *ret
67 : String::Null_();
69 else
71 return i_versionNumber;
75 void
76 SinceTagTransformationData::do_Init( opt_iter & it,
77 opt_iter itEnd )
79 ++it; // Cur is since-file path.
81 CHECKOPT( it != itEnd ,
82 "file path",
83 C_opt_SinceFile );
85 csv::File aSinceFile(*it);
86 csv::OpenCloseGuard aSinceFileGuard(aSinceFile);
87 StreamStr sLine(200);
89 if (aSinceFileGuard)
91 for ( sLine.operator_read_line(aSinceFile);
92 NOT sLine.empty();
93 sLine.operator_read_line(aSinceFile) )
96 if (*sLine.begin() != '"')
97 continue;
99 const char * pVersion = sLine.c_str() + 1;
100 const char * pVersionEnd = strchr(pVersion, '"');
101 if (pVersionEnd == 0)
102 continue;
103 const char * pDisplay = strchr(pVersionEnd+1, '"');
104 if (pDisplay == 0)
105 continue;
106 ++pDisplay;
107 const char * pDisplayEnd = strchr(pDisplay, '"');
108 if (pDisplayEnd == 0)
109 continue;
111 aTransformationTable[ String(pVersion,pVersionEnd) ]
112 = String(pDisplay,pDisplayEnd);
113 sLine.clear();
114 } // end for
115 } // end if
117 ++it; // Cur is next option.
120 } // namespace command
121 } // namespace autodoc
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */