1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*==================================================================================================
18
19    File Name: SYNCML_DM_ChoiceAlert.cc
20
21    General Description: A class representing the alerts.
22
23==================================================================================================*/
24
25#include "dmStringUtil.h"
26#include "SYNCML_DM_ChoiceAlert.H"
27
28void SYNCML_DM_ChoiceAlert::parse(SmlAlertPtr_t  pContent)
29{
30
31  SmlItemListPtr_t  p_alert_list_item;
32
33  if ( pContent == NULL )
34    return;
35
36  SYNCML_DM_Alert::parse(pContent);
37
38  p_alert_list_item = pContent->itemList;
39
40  if (p_alert_list_item != NULL && p_alert_list_item->next != NULL )
41      parseChoices(p_alert_list_item->next->next);
42}
43
44
45void SYNCML_DM_ChoiceAlert::parseChoices(SmlItemListPtr_t p_alert_list_item)
46{
47  SmlItemPtr_t         p_alert_item;
48  SmlPcdataPtr_t       p_alert_data;
49
50  while (p_alert_list_item != NULL)
51  {
52    p_alert_item = p_alert_list_item->item;
53    p_alert_data = p_alert_item->data;
54
55    addChoice((CPCHAR)p_alert_data->content);
56    p_alert_list_item = p_alert_list_item->next;
57  }
58}
59
60void SYNCML_DM_ChoiceAlert::addChoice(const char* choice)
61{
62    choices.push_back(choice);
63}
64