Skip to content

Commit 4a82e11

Browse files
committed
Merge branch 'development' of https://git01.codeplex.com/casablanca into development
2 parents dbf18a2 + ba5db4f commit 4a82e11

29 files changed

+527
-364
lines changed

Release/include/cpprest/astreambuf.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,10 @@
3232
#include <cstring>
3333
#include <math.h>
3434

35-
#if (defined(_MSC_VER) && (_MSC_VER >= 1800))
36-
#include <ppltasks.h>
37-
namespace pplx = Concurrency;
38-
#else
3935
#include "pplx/pplxtasks.h"
40-
#endif
41-
4236
#include "cpprest/basic_types.h"
4337
#include "cpprest/asyncrt_utils.h"
4438

45-
#ifndef _CONCRT_H
46-
#ifndef _LWRCASE_CNCRRNCY
47-
#define _LWRCASE_CNCRRNCY
48-
// Note to reader: we're using lower-case namespace names everywhere, but the 'Concurrency' namespace
49-
// is capitalized for historical reasons. The alias let's us pretend that style issue doesn't exist.
50-
namespace Concurrency { }
51-
namespace concurrency = Concurrency;
52-
#endif
53-
#endif
54-
5539
#if defined(_MSC_VER)
5640
#pragma warning(push)
5741
// Suppress unreferenced formal parameter warning as they are required for documentation.

Release/include/cpprest/asyncrt_utils.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,17 @@
2727

2828
#pragma once
2929

30-
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
31-
#include <ppltasks.h>
32-
namespace pplx = Concurrency;
33-
#else
34-
#include "pplx/pplxtasks.h"
35-
#endif
36-
37-
#include "cpprest/xxpublic.h"
38-
#include "cpprest/basic_types.h"
3930
#include <string>
4031
#include <vector>
4132
#include <cstdint>
4233
#include <system_error>
4334
#include <random>
4435
#include <locale.h>
4536

37+
#include "pplx/pplxtasks.h"
38+
#include "cpprest/xxpublic.h"
39+
#include "cpprest/basic_types.h"
40+
4641
#if !defined(_MS_WINDOWS) || (_MSC_VER >= 1700)
4742
#include <chrono>
4843
#endif

Release/include/cpprest/containerstream.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,10 @@
3232
#include <algorithm>
3333
#include <iterator>
3434

35-
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
36-
#include <ppltasks.h>
37-
namespace pplx = Concurrency;
38-
#else
3935
#include "pplx/pplxtasks.h"
40-
#endif
41-
4236
#include "cpprest/astreambuf.h"
4337
#include "cpprest/streams.h"
4438

45-
#ifndef _CONCRT_H
46-
#ifndef _LWRCASE_CNCRRNCY
47-
#define _LWRCASE_CNCRRNCY
48-
// Note to reader: we're using lower-case namespace names everywhere, but the 'Concurrency' namespace
49-
// is capitalized for historical reasons. The alias let's us pretend that style issue doesn't exist.
50-
namespace Concurrency { }
51-
namespace concurrency = Concurrency;
52-
#endif
53-
#endif
54-
5539
// Suppress unreferenced formal parameter warning as they are required for documentation
5640
#if defined(_MSC_VER)
5741
#pragma warning(push)

Release/include/cpprest/fileio.h

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -31,55 +31,16 @@
3131
****/
3232
#pragma once
3333

34-
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
35-
#include <ppltasks.h>
36-
namespace pplx = Concurrency;
37-
#if (_MSC_VER >= 1900)
38-
#include <concrt.h>
39-
#ifndef DEV14_EXTENSIBILITY_WRKRND
40-
#define DEV14_EXTENSIBILITY_WRKRND
41-
namespace Concurrency {
42-
namespace extensibility {
43-
typedef ::std::condition_variable condition_variable_t;
44-
typedef ::std::mutex critical_section_t;
45-
typedef ::std::unique_lock< ::std::mutex> scoped_critical_section_t;
46-
47-
typedef ::Concurrency::event event_t;
48-
typedef ::Concurrency::reader_writer_lock reader_writer_lock_t;
49-
typedef ::Concurrency::reader_writer_lock::scoped_lock scoped_rw_lock_t;
50-
typedef ::Concurrency::reader_writer_lock::scoped_lock_read scoped_read_lock_t;
51-
52-
typedef ::Concurrency::details::_ReentrantBlockingLock recursive_lock_t;
53-
typedef recursive_lock_t::_Scoped_lock scoped_recursive_lock_t;
54-
}
55-
}
56-
#endif // DEV14_EXTENSIBILITY_WRKRND
57-
#endif // _MSC_VER >= 1900
58-
#else // _MSC_VER
59-
#include "pplx/pplxtasks.h"
60-
#endif
61-
62-
#include "cpprest/xxpublic.h"
63-
6434
#ifdef _MS_WINDOWS
6535
#include <cstdint>
6636
#endif
6737

38+
#include "pplx/pplxtasks.h"
39+
#include "cpprest/xxpublic.h"
6840
#include "cpprest/basic_types.h"
6941

70-
#ifndef _CONCRT_H
71-
#ifndef _LWRCASE_CNCRRNCY
72-
#define _LWRCASE_CNCRRNCY
73-
// Note to reader: we're using lower-case namespace names everywhere, but the 'Concurrency' namespace
74-
// is capitalized for historical reasons. The alias let's us pretend that style issue doesn't exist.
75-
namespace Concurrency { }
76-
namespace concurrency = Concurrency;
77-
#endif
78-
#endif
79-
8042
namespace Concurrency { namespace streams
8143
{
82-
8344
namespace details
8445
{
8546
/// <summary>

Release/include/cpprest/http_client.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,9 @@ typedef void* native_handle;}}}
4343
#include <memory>
4444
#include <limits>
4545

46+
#include "pplx/pplxtasks.h"
4647
#include "cpprest/xxpublic.h"
4748
#include "cpprest/http_msg.h"
48-
49-
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
50-
#include <ppltasks.h>
51-
namespace pplx = Concurrency;
52-
#else
53-
#include "pplx/pplxtasks.h"
54-
#endif
55-
5649
#include "cpprest/json.h"
5750
#include "cpprest/uri.h"
5851
#include "cpprest/web_utilities.h"

Release/include/cpprest/http_msg.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,7 @@
3232
#include <vector>
3333
#include <system_error>
3434

35-
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
36-
#include <ppltasks.h>
37-
namespace pplx = Concurrency;
38-
#if (_MSC_VER >= 1900)
39-
#include <concrt.h>
40-
#ifndef DEV14_EXTENSIBILITY_WRKRND
41-
#define DEV14_EXTENSIBILITY_WRKRND
42-
namespace pplx = Concurrency;
43-
namespace Concurrency {
44-
namespace extensibility {
45-
typedef ::Concurrency::event event_t;
46-
typedef ::Concurrency::reader_writer_lock reader_writer_lock_t;
47-
typedef ::Concurrency::reader_writer_lock::scoped_lock scoped_rw_lock_t;
48-
typedef ::Concurrency::reader_writer_lock::scoped_lock_read scoped_read_lock_t;
49-
50-
typedef ::Concurrency::details::_ReentrantBlockingLock recursive_lock_t;
51-
typedef recursive_lock_t::_Scoped_lock scoped_recursive_lock_t;
52-
}
53-
}
54-
#endif // DEV14_EXTENSIBILITY_WRKRND
55-
#endif // _MSC_VER >= 1900
56-
#else
5735
#include "pplx/pplxtasks.h"
58-
#endif
59-
6036
#include "cpprest/json.h"
6137
#include "cpprest/uri.h"
6238
#include "cpprest/http_headers.h"

Release/include/cpprest/interopstream.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,10 @@
2626
****/
2727
#pragma once
2828

29-
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
30-
#include <ppltasks.h>
31-
namespace pplx = Concurrency;
32-
#else // defined(_MSC_VER) && (_MSC_VER >= 1800)
3329
#include "pplx/pplxtasks.h"
34-
#endif // defined(_MSC_VER) && (_MSC_VER >= 1800)
35-
3630
#include "cpprest/astreambuf.h"
3731
#include "cpprest/streams.h"
3832

39-
#ifndef _CONCRT_H
40-
#ifndef _LWRCASE_CNCRRNCY
41-
#define _LWRCASE_CNCRRNCY
42-
// Note to reader: we're using lower-case namespace names everywhere, but the 'Concurrency' namespace
43-
// is capitalized for historical reasons. The alias let's us pretend that style issue doesn't exist.
44-
namespace Concurrency { }
45-
namespace concurrency = Concurrency;
46-
#endif // _LWRCASE_CNCRRNCY
47-
#endif // _CONCRT_H
48-
4933
#pragma warning(push)
5034
// Suppress unreferenced formal parameter warning as they are required for documentation
5135
#pragma warning(disable : 4100)

Release/include/cpprest/json.h

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,14 @@ namespace json
391391
/// <param name="value">The C++ value to create a JSON value from, a C++ STL double-byte string</param>
392392
_ASYNCRTIMP static value parse(const utility::string_t&);
393393

394+
/// <summary>
395+
/// Attempts to parse a string and construct a JSON value.
396+
/// </summary>
397+
/// <param name="value">The C++ value to create a JSON value from, a C++ STL double-byte string</param>
398+
/// <param name="errorCode">If parsing fails, the error code is greater than 0</param>
399+
/// <returns>The parsed object. Returns web::json::value::null if failed</returns>
400+
_ASYNCRTIMP static value parse(const utility::string_t&, std::error_code&);
401+
394402
/// <summary>
395403
/// Serializes the current JSON value to a C++ string.
396404
/// </summary>
@@ -411,6 +419,14 @@ namespace json
411419
/// <returns>The JSON value object created from the input stream.</returns>
412420
_ASYNCRTIMP static value parse(utility::istream_t &input);
413421

422+
/// <summary>
423+
/// Parses a JSON value from the contents of an input stream using the native platform character width.
424+
/// </summary>
425+
/// <param name="input">The stream to read the JSON value from</param>
426+
/// <param name="errorCode">If parsing fails, the error code is greater than 0</param>
427+
/// <returns>The parsed object. Returns web::json::value::null if failed</returns>
428+
_ASYNCRTIMP static value parse(utility::istream_t &input, std::error_code& error);
429+
414430
/// <summary>
415431
/// Writes the current JSON value to a stream with the native platform character width.
416432
/// </summary>
@@ -424,6 +440,14 @@ namespace json
424440
/// <param name="stream">The stream to read the JSON value from</param>
425441
_ASYNCRTIMP static value parse(std::istream& stream);
426442

443+
/// <summary>
444+
/// Parses a JSON value from the contents of a single-byte (UTF8) stream.
445+
/// </summary>
446+
/// <param name="stream">The stream to read the JSON value from</param>
447+
/// <param name="errorCode">If parsing fails, the error code is greater than 0</param>
448+
/// <returns>The parsed object. Returns web::json::value::null if failed</returns>
449+
_ASYNCRTIMP static value parse(std::istream& stream, std::error_code& error);
450+
427451
/// <summary>
428452
/// Serializes the content of the value into a single-byte (UTF8) stream.
429453
/// </summary>
@@ -634,6 +658,66 @@ namespace json
634658
~json_exception() CPPREST_NOEXCEPT {}
635659
};
636660

661+
namespace details
662+
{
663+
enum json_error
664+
{
665+
left_over_character_in_stream = 1,
666+
malformed_array_literal,
667+
malformed_comment,
668+
malformed_literal,
669+
malformed_object_literal,
670+
malformed_numeric_literal,
671+
malformed_string_literal,
672+
malformed_token,
673+
mismatched_brances,
674+
nesting,
675+
unexpected_token
676+
};
677+
678+
class json_error_category_impl : public std::error_category
679+
{
680+
public:
681+
virtual const char* name() const CPPREST_NOEXCEPT override
682+
{
683+
return "json";
684+
}
685+
686+
virtual std::string message(int ev) const override
687+
{
688+
switch (ev)
689+
{
690+
case json_error::left_over_character_in_stream:
691+
return "Left-over characters in stream after parsing a JSON value";
692+
case json_error::malformed_array_literal:
693+
return "Malformed array literal";
694+
case json_error::malformed_comment:
695+
return "Malformed comment";
696+
case json_error::malformed_literal:
697+
return "Malformed literal";
698+
case json_error::malformed_object_literal:
699+
return "Malformed object literal";
700+
case json_error::malformed_numeric_literal:
701+
return "Malformed numeric literal";
702+
case json_error::malformed_string_literal:
703+
return "Malformed string literal";
704+
case json_error::malformed_token:
705+
return "Malformed token";
706+
case json_error::mismatched_brances:
707+
return "Mismatched braces";
708+
case json_error::nesting:
709+
return "Nesting too deep";
710+
case json_error::unexpected_token:
711+
return "Unexpected token";
712+
default:
713+
return "Unknown json error";
714+
}
715+
}
716+
};
717+
718+
_ASYNCRTIMP const json_error_category_impl& json_error_category();
719+
}
720+
637721
/// <summary>
638722
/// A JSON array represented as a C++ class.
639723
/// </summary>

Release/include/cpprest/producerconsumerstream.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,9 @@
3535
#include <algorithm>
3636
#include <iterator>
3737

38-
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
39-
#include <ppltasks.h>
40-
namespace pplx = Concurrency;
41-
#else
4238
#include "pplx/pplxtasks.h"
43-
#endif
44-
4539
#include "cpprest/astreambuf.h"
4640

47-
#ifndef _CONCRT_H
48-
#ifndef _LWRCASE_CNCRRNCY
49-
#define _LWRCASE_CNCRRNCY
50-
// Note to reader: we're using lower-case namespace names everywhere, but the 'Concurrency' namespace
51-
// is capitalized for historical reasons. The alias let's us pretend that style issue doesn't exist.
52-
namespace Concurrency { }
53-
namespace concurrency = Concurrency;
54-
#endif
55-
#endif
56-
5741
// Suppress unreferenced formal parameter warning as they are required for documentation
5842
#if defined(_MSC_VER)
5943
#pragma warning(push)

Release/include/cpprest/rawptrstream.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,10 @@
3535
#include <algorithm>
3636
#include <iterator>
3737

38-
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
39-
#include <ppltasks.h>
40-
namespace pplx = Concurrency;
41-
#else
4238
#include "pplx/pplxtasks.h"
43-
#endif
44-
4539
#include "cpprest/astreambuf.h"
4640
#include "cpprest/streams.h"
4741

48-
#ifndef _CONCRT_H
49-
#ifndef _LWRCASE_CNCRRNCY
50-
#define _LWRCASE_CNCRRNCY
51-
// Note to reader: we're using lower-case namespace names everywhere, but the 'Concurrency' namespace
52-
// is capitalized for historical reasons. The alias let's us pretend that style issue doesn't exist.
53-
namespace Concurrency { }
54-
namespace concurrency = Concurrency;
55-
#endif
56-
#endif
57-
5842
// Suppress unreferenced formal parameter warning as they are required for documentation
5943
#pragma warning(push)
6044
#pragma warning(disable : 4100)

0 commit comments

Comments
 (0)