1f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org/*
2f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org *  Copyright 2004 The WebRTC Project Authors. All rights reserved.
3f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org *
4f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org *  Use of this source code is governed by a BSD-style license
5f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org *  that can be found in the LICENSE file in the root of the source
6f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org *  tree. An additional intellectual property rights grant can be found
7f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org *  in the file PATENTS.  All contributing project authors may
8f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
9f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org */
10f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org
11f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org#ifndef WEBRTC_BASE_VERSIONPARSING_H_
12f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org#define WEBRTC_BASE_VERSIONPARSING_H_
13f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org
14f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org#include <string>
15f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org
16f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.orgnamespace rtc {
17f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org
18f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org// Parses a version string into an array. "num_expected_segments" must be the
19f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org// number of numerical segments that the version is expected to have (e.g.,
20f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org// "1.1.2.0" has 4). "version" must be an array of that length to hold the
21f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org// parsed numbers.
22f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org// Returns "true" iff successful.
23f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.orgbool ParseVersionString(const std::string& version_str,
24f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org                        int num_expected_segments,
25f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org                        int version[]);
26f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org
27f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org// Computes the lexicographical order of two versions. The return value
28f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org// indicates the order in the standard way (e.g., see strcmp()).
29f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.orgint CompareVersions(const int version1[],
30f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org                    const int version2[],
31f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org                    int num_segments);
32f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org
33f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org}  // namespace rtc
34f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org
35f048872e915a3ee229044ec4bc541f6cbf9e4de1henrike@webrtc.org#endif  // WEBRTC_BASE_VERSIONPARSING_H_
36