blob: 785915c98da314b7c3fa6c6415b3ec41e7b7ea5c [file] [log] [blame]
Logancf3e5212010-12-29 01:44:55 +08001/*
Zonr Chang19218c02012-04-05 10:44:53 +08002 * Copyright 2010-2012, The Android Open Source Project
Logancf3e5212010-12-29 01:44:55 +08003 *
Zonr Chang19218c02012-04-05 10:44:53 +08004 * 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
Logancf3e5212010-12-29 01:44:55 +08007 *
Zonr Chang19218c02012-04-05 10:44:53 +08008 * http://www.apache.org/licenses/LICENSE-2.0
Logancf3e5212010-12-29 01:44:55 +08009 *
Zonr Chang19218c02012-04-05 10:44:53 +080010 * 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.
Logancf3e5212010-12-29 01:44:55 +080015 */
16
Stephen Hines2f6a4932012-05-03 12:27:13 -070017#include "Script.h"
Logancf3e5212010-12-29 01:44:55 +080018
Stephen Hines2f6a4932012-05-03 12:27:13 -070019#include "Source.h"
Logan033f46e2011-01-06 05:51:24 +080020
Zonr Chang19218c02012-04-05 10:44:53 +080021using namespace bcc;
Logancf3e5212010-12-29 01:44:55 +080022
Shih-wei Liao4ce024b2012-04-25 03:40:50 -070023bool Script::reset(Source &pSource, bool pPreserveCurrent) {
24 if (mSource == &pSource) {
25 return false;
Logancf3e5212010-12-29 01:44:55 +080026 }
27
Shih-wei Liao4ce024b2012-04-25 03:40:50 -070028 if (!pPreserveCurrent) {
29 delete mSource;
Logan474cbd22011-01-31 01:47:44 +080030 }
Shih-wei Liao4ce024b2012-04-25 03:40:50 -070031 mSource = &pSource;
Zonr Chang19218c02012-04-05 10:44:53 +080032 return doReset();
Logancf3e5212010-12-29 01:44:55 +080033}
34
Shih-wei Liao4ce024b2012-04-25 03:40:50 -070035bool Script::mergeSource(Source &pSource, bool pPreserveSource) {
36 return mSource->merge(pSource, pPreserveSource);
37}