Home | History | Annotate | Download | only in api
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "sync/api/sync_merge_result.h"
      6 
      7 namespace syncer {
      8 
      9 SyncMergeResult::SyncMergeResult(ModelType type)
     10   : model_type_(type),
     11     num_items_before_association_(0),
     12     num_items_after_association_(0),
     13     num_items_added_(0),
     14     num_items_deleted_(0),
     15     num_items_modified_(0),
     16     pre_association_version_(0) {
     17 }
     18 
     19 SyncMergeResult::~SyncMergeResult() {
     20 }
     21 
     22 // Setters.
     23 void SyncMergeResult::set_error(SyncError error) {
     24   DCHECK(!error.IsSet() || model_type_ == error.model_type());
     25   error_ = error;
     26 }
     27 
     28 void SyncMergeResult::set_num_items_before_association(
     29     int  num_items_before_association) {
     30   num_items_before_association_ = num_items_before_association;
     31 }
     32 
     33 void SyncMergeResult::set_num_items_after_association(
     34     int num_items_after_association) {
     35   num_items_after_association_ = num_items_after_association;
     36 }
     37 
     38 void SyncMergeResult::set_num_items_added(int num_items_added) {
     39   num_items_added_ = num_items_added;
     40 }
     41 
     42 void SyncMergeResult::set_num_items_deleted(int num_items_deleted) {
     43   num_items_deleted_ = num_items_deleted;
     44 }
     45 
     46 void SyncMergeResult::set_num_items_modified(int num_items_modified) {
     47   num_items_modified_ = num_items_modified;
     48 }
     49 
     50 void SyncMergeResult::set_pre_association_version(int64 version) {
     51   pre_association_version_ = version;
     52 }
     53 
     54 ModelType SyncMergeResult::model_type() const {
     55   return model_type_;
     56 }
     57 
     58 SyncError SyncMergeResult::error() const {
     59   return error_;
     60 }
     61 
     62 int SyncMergeResult::num_items_before_association() const {
     63   return num_items_before_association_;
     64 }
     65 
     66 int SyncMergeResult::num_items_after_association() const {
     67   return num_items_after_association_;
     68 }
     69 
     70 int SyncMergeResult::num_items_added() const {
     71   return num_items_added_;
     72 }
     73 
     74 int SyncMergeResult::num_items_deleted() const {
     75   return num_items_deleted_;
     76 }
     77 
     78 int SyncMergeResult::num_items_modified() const {
     79   return num_items_modified_;
     80 }
     81 
     82 int64 SyncMergeResult::pre_association_version() const {
     83   return pre_association_version_;
     84 }
     85 
     86 }  // namespace syncer
     87