1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
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"
36 SinceTagTransformationData::SinceTagTransformationData()
37 : aTransformationTable()
41 SinceTagTransformationData::~SinceTagTransformationData()
46 SinceTagTransformationData::DoesTransform() const
48 return NOT aTransformationTable
.empty();
52 SinceTagTransformationData::DisplayOf( const String
& i_versionNumber
) const
58 sl() << i_versionNumber
;
59 sl().strip_frontback_whitespace();
61 sVersionNumber(sl().c_str());
64 ret
= csv::find_in_map(aTransformationTable
, sVersionNumber
);
71 return i_versionNumber
;
76 SinceTagTransformationData::do_Init( opt_iter
& it
,
79 ++it
; // Cur is since-file path.
81 CHECKOPT( it
!= itEnd
,
85 csv::File
aSinceFile(*it
);
86 csv::OpenCloseGuard
aSinceFileGuard(aSinceFile
);
91 for ( sLine
.operator_read_line(aSinceFile
);
93 sLine
.operator_read_line(aSinceFile
) )
96 if (*sLine
.begin() != '"')
99 const char * pVersion
= sLine
.c_str() + 1;
100 const char * pVersionEnd
= strchr(pVersion
, '"');
101 if (pVersionEnd
== 0)
103 const char * pDisplay
= strchr(pVersionEnd
+1, '"');
107 const char * pDisplayEnd
= strchr(pDisplay
, '"');
108 if (pDisplayEnd
== 0)
111 aTransformationTable
[ String(pVersion
,pVersionEnd
) ]
112 = String(pDisplay
,pDisplayEnd
);
117 ++it
; // Cur is next option.
120 } // namespace command
121 } // namespace autodoc
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */