BsonDocumentWriterContext.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. internal class BsonDocumentWriterContext
  18. {
  19. // private fields
  20. private BsonDocumentWriterContext _parentContext;
  21. private ContextType _contextType;
  22. private BsonDocument _document;
  23. private BsonArray _array;
  24. private string _code;
  25. private string _name;
  26. // constructors
  27. internal BsonDocumentWriterContext(
  28. BsonDocumentWriterContext parentContext,
  29. ContextType contextType,
  30. BsonDocument document)
  31. {
  32. _parentContext = parentContext;
  33. _contextType = contextType;
  34. _document = document;
  35. }
  36. internal BsonDocumentWriterContext(
  37. BsonDocumentWriterContext parentContext,
  38. ContextType contextType,
  39. BsonArray array)
  40. {
  41. _parentContext = parentContext;
  42. _contextType = contextType;
  43. _array = array;
  44. }
  45. internal BsonDocumentWriterContext(
  46. BsonDocumentWriterContext parentContext,
  47. ContextType contextType,
  48. string code)
  49. {
  50. _parentContext = parentContext;
  51. _contextType = contextType;
  52. _code = code;
  53. }
  54. // internal properties
  55. internal BsonDocumentWriterContext ParentContext
  56. {
  57. get { return _parentContext; }
  58. }
  59. internal string Name
  60. {
  61. get { return _name; }
  62. set { _name = value; }
  63. }
  64. internal ContextType ContextType
  65. {
  66. get { return _contextType; }
  67. }
  68. internal BsonDocument Document
  69. {
  70. get { return _document; }
  71. }
  72. internal BsonArray Array
  73. {
  74. get { return _array; }
  75. }
  76. internal string Code
  77. {
  78. get { return _code; }
  79. }
  80. }
  81. }