BsonBinaryReaderBookmark.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Copyright 2010-2014 MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. namespace MongoDB.Bson.IO
  16. {
  17. /// <summary>
  18. /// Represents a bookmark that can be used to return a reader to the current position and state.
  19. /// </summary>
  20. public class BsonBinaryReaderBookmark : BsonReaderBookmark
  21. {
  22. // private fields
  23. private BsonBinaryReaderContext _context;
  24. private int _position;
  25. // constructors
  26. internal BsonBinaryReaderBookmark(
  27. BsonReaderState state,
  28. BsonType currentBsonType,
  29. string currentName,
  30. BsonBinaryReaderContext context,
  31. int position)
  32. : base(state, currentBsonType, currentName)
  33. {
  34. _context = context.Clone();
  35. _position = position;
  36. }
  37. // internal properties
  38. internal int Position
  39. {
  40. get { return _position; }
  41. }
  42. // internal methods
  43. internal BsonBinaryReaderContext CloneContext()
  44. {
  45. return _context.Clone();
  46. }
  47. }
  48. }